Data Analyst

Case File: The First Look

Sabi Logistics hands you a file of six months of deliveries. Before anyone draws a chart, find out what is in it: how many rows and columns, how much is missing, how many rows are repeats, and which city dominates. You do it in real pandas, on a file generated for you alone.

55 min

Sabi Logistics · Delivery 1

The First Look

A six-month export of every delivery has landed in your inbox and nobody has opened it

Chidi Founder · Phone call

Chidi. I have been promising the board numbers for weeks, and Ngozi finally exported every delivery we made since January into one file, deliveries.csv. I opened it in a spreadsheet and it froze. I do not need analysis yet. I need to know what we actually have: how many rows, how many columns, whether there are holes in it, whether anything is in there twice, and which city we deliver to most.

Amara says you can do this in Python in a few lines, and that the answer will be the same every time. That is exactly what I want.

The brief

What you need to know first.

  • A DataFrame is a table: rows are records (here, deliveries), columns are fields. pd.read_csv("deliveries.csv") reads a file into one. Always start by looking: df.head() shows the top rows, df.dtypes the type of each column, df.describe() a summary of the numbers.
  • Size: len(df) is the number of rows, df.shape is (rows, columns).
  • Missing values appear as NaN. df["driver"].isna() is True where a cell is blank, and .sum() counts the Trues. (Adding up True/False works because True is 1.)
  • Repeats: df.duplicated() marks a row True if an identical row appeared earlier. .sum() counts them. A repeated row usually means a double entry, and it would double-count money later.
  • Counting categories: df["city"].value_counts() counts how often each city appears, biggest first, and .idxmax() returns the label of the biggest.
  • Pandas returns numpy numbers. The checker accepts them, but int(...) is tidier when you want a plain number.

The lab: it gives you your own deliveries.csv (the numbers differ for every learner) and a script with five blanks. Press Run, then Check my answers. When all five are right it shows a report reference starting with GT{. Submit it at the bottom of the page.

Preparing your data…

🔒 The debrief unlocks when you close the case. Finish the lab above.

Write the data-quality note

Write the short data-quality note you would put at the top of this analysis: how many rows and columns, what is missing and how many, what is repeated and how you found it, which city is biggest, and what you would do about the missing drivers and the repeated rows before calculating anything else.

0 words

🧪 Want to practise this on your own computer? See how to set up your lab →

📝

Knowledge Check

1 of 3

What does df.duplicated().sum() tell you?

Report a problem

About: /lessons/case-the-first-look