Level 3: Real-World Data Science Exercises
Level 3 is the part of data work tutorials skip: real exports are messy.
Prices arrive as "$1,200.50", the same city is spelled three ways, people
sign up twice and dates are plain text. Here you clean all of it, then merge
tables and build the summaries a manager actually asks for.
As before, every lesson names one trap, like the inner join that drops orders or a pivot table that averages when you wanted totals. The final project puts every step together on a messy order export.
The 9 exercises in this level
- 1 Missing Data in pandas isna, fillna and dropna Find the gaps in a customer table, drop the rows that have no email and fill missing ages with the median. Start here — no prerequisites
- 2 Fixing Column Types in pandas Prices stored as text Turn a price column like "$1,299.00" into real numbers with .str.replace() and pd.to_numeric(), so totals and averages work. Start here — no prerequisites
- 3 Cleaning Text with pandas .str Spaces, capitals and look-alikes " Paris", "paris " and "PARIS" are one city. Normalize a text column with .str.strip() and .str.lower() before you count anything. Start here — no prerequisites
- 4 pandas Dates to_datetime and .dt Convert order dates from text to real dates with pd.to_datetime(), then count the orders of each month with the .dt accessor. Recommended first: Fixing Column Types in pandas
- 5 Removing Duplicates in pandas drop_duplicates with subset A newsletter export lists some people twice. Keep each email's latest sign-up with drop_duplicates(subset, keep="last"). Recommended first: Cleaning Text with pandas .str
- 6 Merging pandas DataFrames Joins with pd.merge() Attach customer names to an order table with pd.merge(), keeping every order even when its customer is unknown. Recommended first: Missing Data in pandas
- 7 Named Aggregations in pandas Several statistics per group Build a per-customer summary (number of orders, total and average spend) in one groupby with named aggregations. Recommended first: Merging pandas DataFrames
- 8 pandas Pivot Tables Rows by columns summaries Turn a long sales list into a region-by-quarter grid with pivot_table(), using totals and zeros for empty cells. Recommended first: Named Aggregations in pandas
- 9 Project: Clean a Messy CSV with pandas Everything from this level Clean a real-looking export (duplicated orders, prices as text, messy status labels, date strings) and report the revenue of each month. Recommended first: pandas Dates, Removing Duplicates in pandas, pandas Pivot Tables
Frequently asked questions
- Why is my number column's dtype object?
- It contains text: currency symbols, commas or words like "n/a". Strip them with `.str.replace()` and convert with `pd.to_numeric(errors="coerce")`.
- What is the difference between an inner and a left join?
- An inner join keeps only the rows that match in both tables. A left join keeps every row of the left table and puts `NaN` where nothing matched.
- Should I drop or fill missing values?
- Drop rows that miss something essential, like an email for a newsletter. Fill values you can estimate fairly, like a median age. Count them first with `isna().sum()`.
- Can I load my own CSV file here?
- Not yet: the exercises build small tables in code. Everything you practise works the same on a file loaded with `pd.read_csv()` on your computer.