Pandas for Data Manipulation
Part of the Data Science Roadmap
In short
If you'll learn one data library really well, make it pandas. It's how most data scientists load, filter, group and reshape tables every single day.
The standard tool for loading, exploring, filtering and transforming tabular data in Python — DataFrames, Series, groupby, merge — used in nearly every data science workflow.

Think of it like this
A college register with superpowers
Picture the office register of every student, with columns for name, branch, city and fees. Now imagine asking it 'show only CSE students from Pune, sorted by fees' and getting the answer instantly. That's a pandas DataFrame.
Watch it happen
Big orders per city, step by step
1/5read_csv loads 50,000 orders into a DataFrame with columns like city and amount.
The big ideas
What you need to know
DataFrame and Series
A DataFrame is a table. Each column is a Series with one data type and a shared index.
Filter with conditions
df[df['city'] == 'pune'] keeps matching rows. Combine conditions with & and |.
Split, apply, combine
groupby splits rows into groups, applies a calculation, then combines the results into a new table.
merge joins tables
pd.merge works like a SQL join, matching rows from two tables on a shared column.
See it in code
Walk through the code
1import pandas as pd2 3df = pd.read_csv("orders.csv") # order_id, city, amount, date4print(df.head())5 6big = df[df["amount"] > 500]7by_city = (big.groupby("city")["amount"]8 .agg(["count", "mean"])9 .sort_values("count", ascending=False))10print(by_city.head(3))1/4Load the CSV and peek at the first five rows.
Load, filter, group, sort. This four-step pattern answers a surprising number of business questions.
Save yourself the pain
Common mistakes
Oops
Looping over rows with iterrows to do maths.
Do this instead
Use column operations like df['a'] * df['b']. They're vectorised and far faster.
Oops
Changing a filtered slice and getting a SettingWithCopyWarning.
Do this instead
Use .loc[rows, 'col'] = value on the original, or call .copy() on the slice first.
Your mission
Answer three questions
Quick check
Which line gives the average amount per city?
Go deeper
- 1Load a CSV into a DataFrame and explore it with .head(), .info(), .describe().
- 2Practice filtering, grouping, and merging DataFrames on a sample dataset.
- 3Learn .loc versus .iloc for label-based versus position-based selection.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.