Indexing & Slicing

Indexing and Slicing NumPy Arrays

Transcript

Integer and tuple indexing for scalars and sub-arrays, negative indices, and indexing multiple dimensions — including where you get a lower-dimensional view versus a scalar. Then slicing with start:stop:step, omitting bounds, and how slices share memory with the parent array. We connect mental models for 3D batches (e.g. images) with row/column patterns you will reuse in Pandas iloc and framework tensor batching, and we flag edge cases where mixed indexing forces copies.