1/8
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['log_n_genes'] = np.log1p(df['n_genes']) do if log_n_genes doesn't exist yet?
Creates a new column with that name; if it already existed, it would be overwritten.
What does each step in this chain return, and why does that let you call the next method directly?
top_cells = (
df[df['pct_mito'] < 10]
.sort_values('n_genes', ascending=False)
.head(10)
)
Each step (df[...], .sort_values(), .head()) returns a new DataFrame, so the next method can be called immediately without an intermediate variable.
How does this pandas chaining pattern relate to SpatialData plotting calls like sdata.pl.render_shapes(...).pl.render_points(...).pl.show()?
Same underlying principle → each call returns something you can keep calling methods on but just applied to a different set of methods.
What is AnnData designed to bundle together, beyond just a count matrix?
The count matrix (cells × genes) plus metadata about cells, metadata about genes, and derived results (PCA, UMAP, clustering) → all kept aligned with each other.
Why not just use separate DataFrames for the count matrix and cell metadata?
Filtering out low-quality cells would require manually keeping every separate DataFrame in sync
AnnData bundles them so filtering keeps everything aligned automatically.
In X = np.random.poisson(1, size=(100, 2000)), what do the two dimensions represent?
100 rows = cells/observations; 2000 columns = genes/variables.
What does adata.obs_names = [...] set?
Names/labels for each cell (observation).
What does adata.var_names = [...] set?
Names/labels for each gene (variable).
What is AnnData's axis order convention?
(n_obs, n_vars) → observations (cells) first, variables (genes) second.