Quiz: How do you compute both the mean and maximum of 'latency' grouped by 'region' in a Pandas DataFrame?
df.groupby('col').agg(['mean', 'max']) applies multiple aggregation functions across groups in a single efficient pass.
Find tutorials, system documentation, dynamic pages, and interactive quizzes in one place.
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%.
pd.to_datetime() parses string timestamps into DatetimeIndex/Series, and the .dt accessor exposes vectorized calendar properties.
.pipe() enables method-chaining for user-defined functions: df.pipe(clean).pipe(transform) instead of nested calls.
scipy.optimize provides functions like minimize() , curve_fit() , and root() for mathematical optimization.
scipy.stats.norm.pdf(x, loc, scale) evaluates the Gaussian probability density function where loc is mean and scale is standard deviation.
Never invert matrices directly: scipy.linalg.solve uses efficient LU/Cholesky decomposition , avoiding instability and O(n³) cost.