iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up
Next »

Summary

NumPy + Pandas track summary: the core mental model, the daily reflexes, and the next steps after the course.

NumPy + Pandas — track summary

EXAMPLE
# ===== Core mental model =====
# NumPy: typed n-dim arrays + vectorised math (the engine)
# Pandas: labelled tabular data on top (the analysis tool)

# ===== NumPy daily reflexes =====
# - Create with np.array, np.zeros, np.arange, np.linspace
# - Reshape, broadcast, slice (view), boolean mask (copy)
# - Vectorise: np.sin / np.exp / @ (matmul) over for loops
# - Choose dtypes: int32/int64/float32/float64
# - Watch axes: reductions take axis=

# ===== Pandas daily reflexes =====
# - DataFrame as a dict of typed Series
# - Read CSV / Parquet with explicit dtypes
# - Filter: boolean masks with & | ~ + parens; .query for readable filters
# - Group: groupby + agg / transform / apply
# - Reshape: pivot, pivot_table, melt, stack, unstack
# - Time series: datetime index + resample / rolling
# - Categorical for low-cardinality strings
# - Always specify TIMESTAMPTZ-style timezone behaviour

# ===== Performance reflexes =====
# - Vectorise, don't loop
# - Use category for repeated strings
# - Use pyarrow backend (Pandas 2+)
# - Reach for Polars / DuckDB when dataset > 1 GB

# ===== The wider ecosystem =====
# - matplotlib / seaborn: plotting
# - scikit-learn: classical ML built on NumPy
# - statsmodels: statistics
# - SciPy: optimisation, signal processing
# - PyTorch / TensorFlow: deep learning (NumPy-shaped tensors)

# ===== What comes next =====
# - Polars: faster Pandas alternative (Rust + Apache Arrow)
# - DuckDB: SQL on Pandas / Parquet, very fast
# - dbt: data modelling on warehouses
# - Spark / Dask: distributed dataframes
# - Notebooks: Jupyter, Marimo, Quarto for reports

# ===== Patterns to internalise =====
# - Vectorise everywhere
# - Explicit dtypes + tz
# - Chained transforms with .assign / .query
# - Pyarrow backend for big data
# - Pandas first; Polars / DuckDB when scale demands

# ===== Pitfalls =====
# - .apply with Python lambdas on hot columns
# - object dtype for strings (slow, big memory)
# - SettingWithCopyWarning -> use .loc / .copy
# - Time series without tz -> daylight saving bugs

# ===== Where to publish =====
# - Kaggle notebooks for visibility
# - GitHub portfolio repos
# - Personal blog with rendered notebooks (Quarto / Nbdev)

# ===== Books worth reading =====
# - Python for Data Analysis, Wes McKinney
# - Effective Pandas, Matt Harrison
# - Fluent Python, Luciano Ramalho

# ===== Closing thought =====
# Pandas is messy enough to be flexible; NumPy is strict enough to be fast.
# Use them well and most data work becomes 'read -> shape -> agg -> chart' in 50 lines.

Why it matters

Master the array + dataframe mental model, vectorise everything, pick dtypes deliberately, and treat Pandas as the daily driver until scale demands Polars / DuckDB. The skill compounds across every Python stack you touch — from analytics to ML to deep learning.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
# Next: Polars for speed, PyArrow data types, Dask for out-of-core, DuckDB inside pandas.
Try it Yourself »

Discussion

Loading…

Next »