Quiz: What occurs in memory when you slice a NumPy array (e.g., `b = a[1:5]`) versus boolean indexing (`c = a[a > 0]`)?
Basic slicing returns a view sharing the original array buffer; fancy/boolean indexing creates a brand new copy .
Find tutorials, system documentation, dynamic pages, and interactive quizzes in one place.
Basic slicing returns a view sharing the original array buffer; fancy/boolean indexing creates a brand new copy .
Passing -1 signals NumPy to dynamically compute that dimension based on the total elements and specified dimensions.
A Series is a 1D labeled array capable of holding any data type; a DataFrame is a 2D tabular structure aligned by index and columns.
.loc[] indexes by index/column labels and includes the stop slice; .iloc[] indexes by 0-based integer positions and excludes the stop slice.
df.fillna() fills NaN values using a specified scalar, dictionary, or imputation strategy (e.g. forward/back fill).
df.groupby('col').agg(['mean', 'max']) applies multiple aggregation functions across groups in a single efficient pass.
By default, pd.merge() performs an inner join unless specified otherwise with the how= parameter.
Converting low-cardinality strings to category stores an internal integer lookup table with unique categories, reducing memory by up to 90%.