Pandas mock tests
Test yourself on the whole course, against the clock: questions from every module, then coding problems you solve and run right here. Your score comes at the end, with every answer explained.
Each mock test has 12 questions drawn from the lessons, and 45 minutes on the clock, which keeps running if you reload. Questions are worth a point each. Score 60% or more to pass; your best score is kept.
- 01Mock test 112 questions · 45 minutes · 12 points
- 02Mock test 212 questions · 45 minutes · 12 points
Part A · 12 questions
- How do you sort a DataFrame df by score, highest first?
- Which line correctly sets Leo's score to 81?
- Which kind of chart shows how a single numeric column is distributed?
- What is the difference between loc and iloc?
- Which method shows column types and missing values?
- What does indicator=True add to a merge result?
- With bins=[0, 60, 75, 90, 100], which bin does a score of 75 fall into?
- Which option makes read_csv treat "n/a" as a missing value?
- What is the difference between loc and iloc?
- Scores are 95, 88, 88, 72. With rank(ascending=False, method="dense"), what rank does 72 get?
- In df.plot(), what goes along the x-axis by default?
- What does df.dropna(subset=["score"]) do?
Part A · 12 questions
- How do you add a column total equal to quantity times price?
- Which method applies several aggregations, such as count and sum, at once?
- Which keeps rows where price is under 50 AND stock is over 10?
- What does df.groupby("team")["score"].mean() return?
- people["city"].map({"Mumbai": "BOM"}) is applied to a row where city is "Paris". What does it become?
- Why read a column of postal codes with dtype={"code": str}?
- What do you get from df["price"]?
- df.sort_values("score") runs, but df is still unsorted. Why?
- What does index=False do in df.to_csv("out.csv", index=False)?
- What does pd.merge(a, b, on="id") do with rows whose id appears in only one table?
- A Series holds 10, NaN and 30. What does .mean() return?
- How do you count the missing values in each column of df?