From here on, you'll work with real-looking data: py-sales.csv, six months of orders from a wholesale distributor with branches in Ikeja, Lekki, Abuja, Port Harcourt, Kano and Ibadan. Download it from this lesson and upload it to Colab (lesson 1.2).
Load the file
import pandas as pd
df = pd.read_csv("py-sales.csv")
import pandas as pdloads the pandas library and gives it the short namepd. Everyone uses this name, so you'll see it in every example online.pd.read_csv()reads the file into a DataFrame: a table with named columns and numbered rows. By habit, it's calleddf.
For Excel files, use pd.read_excel("file.xlsx"), or pd.read_excel("file.xlsx", sheet_name="June") for a particular sheet.

The first look
Before analysing anything, look at what you've got. These four commands answer most questions.
head() shows the first five rows (head(10) shows ten):
df.head()
order_id date branch rep customer product category qty unit_price payment status
0 KD-10001 2026-01-01 Abuja Hauwa Bello Amaka Supermarket Sugar 50kg bag Grains 6 59800 Transfer Paid
1 KD-10002 2026-01-01 Abuja Peter Udoh Alhaji Musa Ventures Rice 50kg bag Grains 4 79600 POS Paid
2 KD-10003 2026-01-01 Ibadan Wale Ojo Emeka Enterprises Seasoning cubes (carton) Cans 10 10000 Transfer Paid
3 KD-10004 2026-01-01 Kano Aminu Sule Ibrahim Stores Spaghetti (carton of 20) Pasta 3 17800 Transfer Paid
4 KD-10005 2026-01-01 Lekki Ada Okafor Chinedu Provisions Vegetable oil 25L Oils 2 53000 Transfer Paid
Colab shows this as a neat table. Each column is a field, each row is one order line.
shape gives the number of rows and columns:
df.shape
(900, 11)
900 order lines, 11 columns. Note there are no brackets after shape. It's a property, not an action.
info() lists every column, how many values are filled in, and the type of each:
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 900 entries, 0 to 899
Data columns (total 11 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 order_id 900 non-null object
1 date 900 non-null object
2 branch 900 non-null object
3 rep 900 non-null object
4 customer 900 non-null object
5 product 900 non-null object
6 category 900 non-null object
7 qty 900 non-null int64
8 unit_price 900 non-null int64
9 payment 900 non-null object
10 status 900 non-null object
dtypes: int64(2), object(9)
memory usage: 77.5+ KB
int64 means whole numbers, object usually means text. Here every column has 900 non-null values, so nothing is missing. In Module 4 you'll meet a file where that isn't true.
describe() summarises the number columns: count, average (mean), smallest, largest and the quartiles:
df[["qty", "unit_price"]].describe().round(0)
qty unit_price
count 900.0 900.0
mean 8.0 27012.0
std 10.0 22895.0
min 1.0 2400.0
25% 2.0 12600.0
50% 5.0 17600.0
75% 10.0 38400.0
max 50.0 81900.0
Quantities run from 1 to 50 (the big ones are packs of bottled water), and unit prices from ₦2,400 to ₦81,900. If you saw a quantity of 10,000 or a price of ₦0 here, you'd know something was wrong before any analysis.
Loading from Google Drive
Uploaded files disappear when the runtime stops. To keep data between sessions, put it in Google Drive and connect Drive to Colab:
from google.colab import drive
drive.mount("/content/drive")
df = pd.read_csv("/content/drive/MyDrive/python-course/py-sales.csv")
Colab asks you to allow access the first time. After that, the path works like any folder.
Check yourself
Answer in your head first, then open each question to see the answer and why.
What does pd.read_csv("py-sales.csv") return?
- A A DataFrame: a table with named columns and numbered rows
- B A list of numbers
- C A chart
- D A text file
Show the answer
A) A DataFrame: a table with named columns and numbered rows — pandas reads the file into a DataFrame.
What does df.shape tell you?
- A The number of rows and columns
- B The first five rows
- C The average of every column
- D The file's size in MB
Show the answer
A) The number of rows and columns — shape is (rows, columns).
Which command shows each column's type and how many values are filled in?
- A df.info()
- B df.head()
- C df.sum()
- D df.shape
Show the answer
A) df.info() — info() lists columns, non-null counts and types.
More free lessons: What Python can do for your work · Lists and loops · Fixing text and numbers stored as text · Combining many files into one · Using AI coding assistants wisely