Numpy Tutorials

Searching Filtering and Sorting

EN

A search may need values, coordinates, or an ordering. These are different outputs. Decide which one you need before choosing where, nonzero, argsort, or searchsorted...

Combining Arrays

EN

Joining arrays is a modeling choice. Does the new data add observations, add features to existing observations, or add a new experiment axis? Those choices call for different shapes, even when all inputs contain the same number of elements...

Reshaping Arrays

EN

Reshaping preserves the number of elements...

Linear Equations

EN

For A ∈ ℝ^(m×n), x ∈ ℝⁿ, and b ∈ ℝ^m...

Accessing Modifying Elements

EN

Indexing answers two questions: which values are selected, and whether the selection shares storage with the original. The second question determines whether a later assignment changes your input...

Creating Arrays

EN

An array has three separate properties: its shape says how values are indexed, its dtype says how each value is represented, and its data contains the values. Choosing the wrong dtype can change an answer even when the shape is right...

Matrix Operations

EN

A real matrix A ∈ ℝ^(m×n) maps n-component input vectors to m-component output vectors. The formula...

Statistics and Random Numbers

EN

A statistic summarizes the data you actually have. A probability model describes how data might be generated. A sample's mean is not required to equal its model's mean, and changing an axis, denominator, or weighting rule can change which quantity you are computing...

Vector Operations

EN

A real coordinate vector v = (v₀,…,vₙ₋₁) is an ordered list of n components. A NumPy array of shape (n,) is a convenient representation, but NumPy's shape rules are part of the calculation: they are not mathematical row/column notation inferred from how an array is printed...