What is pandas?
pandas is a Python library for working with tabular data -- rows and columns, like a spreadsheet or a CSV file, except you filter, sort and summarize it with code instead of clicking around a UI. It's the standard starting point for data analysis in Python.
Importing pandas
import pandas as pd
pd is just a conventional short name -- everyone writes it this way, so your code reads the same as everyone else's.
Creating a DataFrame
A DataFrame is pandas' table type. The simplest way to build one is from a dict, where each key becomes a column:
data = {
"name": ["Ada", "Tomi", "Chidi", "Bola"],
"score": [60, 70, 80, 90],
}
df = pd.DataFrame(data)
print(df)
name score
0 Ada 60
1 Tomi 70
2 Chidi 80
3 Bola 90
The leftmost column (0, 1, 2, 3) is the index -- pandas adds it automatically to label each row.
Picking out a column
print(df["score"])
A single column (df["score"]) is a Series -- a DataFrame is really just a collection of Series sharing one index.
Peeking at a big table
print(df.head()) # first 5 rows by default
Quick summaries
print(df["score"].mean()) # average
print(df["score"].sum()) # total
print(df["score"].max()) # highest
print(df["score"].min()) # lowest
Why This Matters for Your Exams
Almost everything else in data analysis is built on these two ideas: a DataFrame is a table, and df["column"] pulls out one column as a Series. Get comfortable with that before anything else -- filtering, grouping, and cleaning are all just operations on top of it.
Try it yourself
Real-time practice is a paid add-on
Reading units and the practice quiz are free. Pay once to unlock running real code for DATASCI.

