1/6
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 df.dtypes show?
The data type of each column, e.g. int64 (whole numbers), float64 (decimals), object (text/strings), bool (True/False).
Why check .dtypes before analysis?
To catch numeric columns that accidentally loaded as text (e.g. due to a stray comma), which would break or silently corrupt calculations like .mean().
What does df.loc['AAACCT'] select?
The row labeled AAACCT → selection by label
What does df.iloc[0, :] select?
The first row (position 0), all columns → selection by position, regardless of labels.
What is the core difference between .loc and .iloc?
.loc selects by the label you can see (index name, column name); .iloc selects by numeric position (0, 1, 2...)
Why can .iloc give unexpected results after sorting or filtering a DataFrame?
Positions shift when rows are reordered or removed, so .iloc[0] gives whatever ended up first → not necessarily the row you originally meant.
.loc['label'] always returns that specific row regardless of ordering.
What does df.loc['AAACCT':'AACTGG', ['n_genes', 'cell_type']] select?
A block of rows from AAACCT to AACTGG (inclusive, by label) and just the n_genes and cell_type columns