Why this matters
pandas is the Python library analysts use for tables. It does what you already do in spreadsheets, such as filtering, sorting, cleaning, lookups and pivot tables, but on bigger files and as repeatable steps. If an advert mentions Python for data analysis, it almost always means pandas.
Loading data
In Colab, upload a CSV file using the files panel on the left, then:
import pandas as pd
df = pd.read_csv("survey.csv")
df.head()A table in pandas is called a DataFrame, usually named df. df.head() shows the first five rows. df.shape gives rows and columns, and df.info() lists each column's type and how many values are missing. Always run these first, just as you would scan a sheet before analysing it.
Selecting and filtering
df["community"]
df[df["hh_size"] > 10]The first line selects one column. The second keeps only households with more than ten members. Combine conditions with & (and) and | (or), each condition in brackets.
Summarising
df["community"].value_counts() counts records per community. To total a column by group, like a pivot table: