1/11
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 import numpy as np do?
Imports the NumPy library under the shortcut name np, so you can call np.something() instead of the full name.
What does np.loadtxt('expression.csv', delimiter=',') do?
Loads a CSV file into a NumPy array, splitting values by comma
What does data.shape tell you, and why check it first?
The dimensions of the array (e.g. (60, 40) = 60 rows, 40 columns); checking it first catches transposed data, duplicate loads, or empty files immediately.
What does data.dtype tell you?
The data type stored in the array, e.g. float64 = decimal numbers
Why is NumPy faster than plain Python lists for numeric work?
A NumPy array is one block of memory holding numbers of a single consistent type, which makes operations like np.mean() much faster than looping over Python lists.
What does data[0, :] select?
Row 0, all columns (all genes for the first cell)
What does data[:, 5] select?
All rows, column index 5 (gene index 5 across all cells)
What does data[0:10, 0:4] select?
A block: rows 0–9, columns 0–3
What is the general indexing pattern for NumPy arrays?
data[rows, columns] → a single number picks one row/column, : means "all," a:b means a slice
What does axis=0 collapse when used in np.mean(data, axis=0)?
It collapses down the rows, giving one result per column (per gene)
What does axis=1 collapse when used in np.mean(data, axis=1)?
It collapses across the columns, giving one result per row (per cell)
Memory trick for remembering axis=0 vs axis=1?
The axis number tells you which dimension gets "squashed" — axis 0 squashes rows, axis 1 squashes columns