Pandas Tutorial
Master data analysis in Python with Pandas — 54 interactive lessons from your first Series to scaling up with Dask, Polars, Spark and GeoPandas.
Learn Pandas from scratch — DataFrames, Series, filtering, grouping, joining and cleaning real data — with free, interactive, beginner-to-advanced lessons.
Part of the free Pandas course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
👋 New to Pandas? Some Python basics are all you need.
Start with Lesson 1 and build real data-analysis skills step by step — at your own pace.
Lessons in this course
- Introduction to Pandas — What Pandas is, why it powers data analysis, and how to install and import it
- The Series: Pandas' 1-D Building Block — Create and work with a Series — a labelled one-dimensional array
- The DataFrame: Rows and Columns — Understand the DataFrame — Pandas' core 2-D table of rows and columns
- Creating DataFrames — Build DataFrames from dicts, lists, and NumPy arrays
- Reading & Writing Data (CSV, Excel, JSON) — Load and save data with read_csv, read_excel, read_json and to_* methods
- Inspecting Data: head, tail, info, describe — Get a fast overview of any dataset with the core inspection methods
- Selecting Columns and Rows — Pick out the exact columns and rows you need from a DataFrame
- Filtering with Boolean Masks — Keep only the rows that match your conditions using boolean masks
- loc vs iloc: Label vs Position — Master the two indexers — label-based loc and position-based iloc
- Adding, Modifying & Dropping Columns — Create new columns, transform existing ones, and remove what you don't need
- Handling Missing Data (NaN, fillna, dropna) — Detect, fill, and drop missing values to clean real-world datasets
- Sorting and Ranking — Order data by values or index and assign ranks within columns
- apply, map & applymap — Run custom functions across Series and DataFrames element by element
- String Operations with .str — Clean and transform text columns with vectorised string methods
- Working with Dates & Times — Parse, extract, and resample datetime data with the .dt accessor
- GroupBy: Split-Apply-Combine — Group rows and compute summaries with the split-apply-combine pattern
- Aggregation & Transformation — Apply multiple aggregations and group-aware transforms in one step
- Merging & Joining DataFrames — Combine datasets on keys with inner, left, right, and outer joins
- Concatenating & Appending — Stack DataFrames vertically and horizontally with pd.concat
- Pivot Tables & Crosstab — Reshape and summarise data into spreadsheet-style pivot tables
- Reshaping: melt, stack, unstack — Move between wide and long formats with melt, stack, and unstack
- MultiIndex (Hierarchical Indexing) — Work with multiple index levels for richer, hierarchical data
- Performance: vectorization & memory — Write fast, memory-efficient Pandas by vectorising and downcasting
- The Index: set_index, reset_index & reindex — Work with the Index — set a meaningful index, reset it, and reindex for fast lookups
- Data Types & astype — Inspect dtypes and convert columns with astype and to_numeric for speed and correctness
- Categorical Data — Save memory and add order with the category dtype and the .cat accessor
- Dropping & Deduplicating Rows — Remove rows and duplicates with drop, drop_duplicates, and duplicated
- Renaming & Relabelling — Rename columns and index labels cleanly with rename, add_prefix, and add_suffix
- Counting & Uniques — Summarise categories fast with value_counts, unique, and nunique
- Filtering with query() & eval() — Write readable filters and computed columns with query() and eval()
- Replacing Values: replace, where & mask — Swap and conditionally overwrite values with replace, where, mask, and clip
- Checkpoint: Cleaning & Wrangling — Combine indexing, dtypes, dropping, renaming and replacing in a build — then a quiz
- Binning Continuous Data: cut & qcut — Group numbers into ranges with cut for fixed edges and qcut for quantiles
- One-Hot Encoding with get_dummies — Turn category columns into model-ready 0/1 columns with get_dummies
- Rolling & Expanding Windows — Compute moving averages and running totals with rolling, expanding, and ewm
- GroupBy transform & filter — Add group-aware columns with transform and keep/drop whole groups with filter
- Time Series Ops: shift, diff & pct_change — Lag, difference, and compute returns over time with shift, diff, and pct_change
- Plotting with DataFrame.plot() — Make quick line, bar, histogram, and scatter charts straight from a DataFrame
- Method Chaining & .pipe() — Write clean, readable pipelines with chaining, assign, and pipe
- Styling & Formatting Output — Control display options and format tables with round, to_markdown, and .style
- Checkpoint: Analysis & Aggregation — Combine binning, windows, transforms and time-series ops in a build — then a quiz
- Time Series Resampling (resample, asfreq) — Downsample and upsample time series with resample and asfreq
- Interpolation & Filling Gaps — Fill missing values with linear, time, and polynomial interpolation
- Exploding Lists into Rows (explode) — Turn a column of lists into one row per element with explode
- Cross-Tabulation (crosstab) — Count and summarise category combinations with pd.crosstab
- Reading & Writing SQL — Move data between pandas and databases with read_sql and to_sql
- Efficient Formats: Parquet, Feather & Pickle — Store data faster and smaller than CSV with columnar formats
- Ranking & Top-N (rank, nlargest) — Rank rows, find the top N, and rank within groups
- Checkpoint: Time Series & I/O — Combine SQL loading, resampling and ranking in a build — then a quiz
- Capstone: End-to-End Data Cleaning — Combine every skill into a complete real-world data-cleaning pipeline
- Scaling with Dask — Go beyond memory with Dask's partitioned, parallel, pandas-like DataFrame
- Polars: A Faster DataFrame — Rust-backed speed with lazy evaluation, expressions, and Arrow memory
- Pandas & Spark — Process big data across a cluster with PySpark and the pandas API on Spark
- Geospatial Data with GeoPandas — Work with geometries, CRS, spatial joins, and maps using GeoDataFrames