liveBook · Manning

Fancy indexing

Fancy indexing is selecting multiple array elements or positions with a collection of integer, Boolean, or label-based selectors.

How 2 Manning books explain it

Pandas Workout: 200 exercises to make you a stronger data analyst

Fancy indexing selects multiple positions or labels by supplying an index collection rather than a single index.

How it is used
Selects multiple Series positions or DataFrame rows and columns, then supports targeted retrieval and assignment.
How deep it goes
Explains list-based and boolean selection through loc syntax, returned shapes, mask distinctions, and multi-value assignment.
Examples
Uses labeled Series values, a five-by-five DataFrame, conditional selectors, and missing product sales filled by indexed assignment.
What you can do after
Apply it via pandas loc to retrieve or update selected positions, rows, columns, and conditionally matched cells.

Read how Pandas Workout: 200 exercises to make you a stronger data analyst explains fancy indexing →

Fast Python: High performance techniques for large datasets

How it is used
Selects multiple NumPy array positions using index collections for each dimension.
How deep it goes
Explains paired indexing and copy semantics, contrasting them with stride-based views without developing broader view mechanics.
Examples
Uses a 2 × 5 matrix, paired row and column lists, selected values, and np.shares_memory.
What you can do after
Apply it to select paired positions and verify whether the result shares storage with the source array.

Read how Fast Python: High performance techniques for large datasets explains fancy indexing →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.