1/4
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
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
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
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.
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.
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.