Learnr

Learn pandas

Load, clean, reshape and summarize data in Python with confidence.

or browse all courses.

Free to start. Built from a single prompt. No credit card.

pandas is the Python library most data work runs through. Its two core objects are the Series, a labeled one-dimensional array, and the DataFrame, a table of columns that share an index. With them you read CSV, Excel and SQL data, select and filter rows, fix types and missing values, group and aggregate, join tables and reshape between wide and long formats. The library is large, but a small core covers most daily work. Learnr builds a personalized pandas course and teaches that core through short interactive lessons with realistic messy datasets.

How to learn pandas, step by step

  1. Make sure your Python basics are solid. Lists, dictionaries, functions, loops and lambda expressions all appear constantly in pandas code. Learn to work in a Jupyter notebook so you can inspect results after every step.
  2. Load a real CSV and inspect it. Use read_csv, then head, info, describe, shape and value_counts to understand what you have. Check dtypes immediately, because numbers read in as text and unparsed dates cause many later errors.
  3. Master selection with loc and iloc. Use loc for label-based selection and iloc for position-based selection, and combine conditions in boolean masks with & and |, each wrapped in parentheses. Assign with df.loc[mask, column] to avoid chained assignment warnings.
  4. Clean the data deliberately. Handle missing values with isna, fillna and dropna, remove duplicates, convert types with astype and pd.to_datetime, and tidy text with the .str accessor. Decide each fix based on what the missing or odd values mean.
  5. Learn groupby, merge and reshaping. Practice split-apply-combine with groupby and agg, join tables with merge using the right how and validate options, and move between wide and long formats with pivot_table and melt.
  6. Write vectorized, readable pandas. Replace row-by-row loops and most apply calls with vectorized column operations, and chain steps with assign and pipe. Revisit the methods in short Learnr lessons so you stop needing to look up the same syntax.

What you'll learn

  • Load data from CSV, Excel and SQL into DataFrames and inspect it
  • Select and filter data with loc, iloc and boolean masks
  • Clean missing values, duplicates and incorrect data types
  • Aggregate with groupby and combine tables with merge and concat
  • Reshape data with pivot_table and melt and work with dates

What's inside your pandas course

A sample path Learnr builds for pandas. Your real course adapts to your goal and level.

  • 1. Series, DataFrames and the index
  • 2. Reading data and first inspection
  • 3. Selecting, filtering and sorting
  • 4. Cleaning: missing values, types and strings
  • 5. groupby, merges and reshaping
  • 6. Time series and method chaining

How long does it take to learn pandas?

With basic Python, the everyday core of pandas takes about 3 to 6 weeks at 4 to 6 hours a week. Comfort with groupby, merges, reshaping and time series on messy real data usually comes after 2 to 3 months of regular use.

What you need before you start

Basic Python: variables, lists, dictionaries, functions and loops. Familiarity with spreadsheets or SQL helps because many pandas operations have direct equivalents there.

Common mistakes to avoid

  • Looping over rows with iterrows for calculations that a vectorized column operation would do far faster and in one line.
  • Chained indexing like df[df.a > 0]["b"] = 1, which may modify a copy instead of the original. Use df.loc with a mask and a column.
  • Merging without checking key uniqueness, so a many-to-many join quietly multiplies rows. Pass validate="one_to_one" or similar to catch it.

How Learnr builds your course

Type your topic

Tell Learnr you want to learn pandas, or get as specific as you like.

Get a personalized course

Learnr instantly builds a full pandas course tailored to your goal and skill level.

Learn and level up

Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.

pandas questions, answered

Should I learn pandas or SQL first?

If you already know Python, pandas is a natural next step. If you work mostly with company databases, SQL may come first. Many analysts use both, since the concepts of filtering, grouping and joining map closely between them.

What is the difference between pandas and NumPy?

NumPy provides fast numerical arrays, and pandas is built on top of it to add labeled rows and columns, mixed data types per column and tools for missing data, grouping and time series.

Explore more courses

More data and ai courses

See all data and ai courses

Ready to learn pandas?

Start your free, personalized pandas course in seconds. .