Deck 1: Building and Loading a DataFrame

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:09 PM on 8/10/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

5 Terms

1
New cards

What does building a DataFrame from a dictionary look like, and what becomes the column names?

cell_info = pd.DataFrame({

'barcode': [...], 'n_genes': [...], ...

})

  • The dictionary keys become column names; each list becomes that column's values

2
New cards

What is the key upgrade a DataFrame gives you over a plain NumPy array?

Labels (column names, row index) plus the ability for each column to hold a different type → a NumPy array requires everything to be one type

3
New cards

What does index_col='barcode' do in pd.read_csv('cell_metadata.csv', index_col='barcode')?

Sets the barcode column as the row index instead of using a default numeric index (0, 1, 2...), so rows can be looked up by their meaningful label.

4
New cards

Why is setting a meaningful index (like barcode) useful beyond just readability?

It lets you write df.loc['AAACCT'] directly, and makes cross-referencing against other tables (e.g. AnnData's obs, or a Shapes element) by that same ID straightforward.

5
New cards

What three things should you check immediately after loading a new DataFrame?

.shape, .columns, and .head() → size, what columns exist, and what a few rows look like.