Python Pandas Foundation
Pandas Topic 13 Foundation

Tables you can query with code

A DataFrame is a labeled table: rows + named columns. Filter, group, and summarize without rewriting loops for every report.

Picture this: a spreadsheet in Python

Rows and named columns. Filter, group, plot from the table.

CSV / dictraw data
→
DataFrametable
→
filter / groupquestions
→
answer tableor a chart

In easy words

Think of an Excel sheet that speaks Python. Columns have names. You select with df["score"], filter with conditions, and summarize with groupby.

Diagram — DataFrame table

name score Ada 90 Riya 85 filter / groupby rows × columns of labeled data

Where this shows up

CSV reports, attendance sheets, sales ledgers, experiment logs, API tables, and data cleaning before ML.

Key facts

  • DataFrame — 2D labeled table (rows × columns).
  • Series — One column (or a single row vector).
  • Boolean mask — True/False per row for filtering.
  • groupby — Split → apply → combine summaries.

What to remember

  • Import — import pandas as pd
  • Inspect — df.head(), df.columns, df.shape
  • Select column — df["col"] returns a Series
  • Chain carefully — Filter before group for clarity
Interactive visualizer

Tiny gradebook

namescore
Full DataFrame
Common operations
Createpd.DataFrame({...})
Selectdf["score"]
Filterdf[df.score >= 85]
Groupdf.groupby("cat").mean()

Pandas — Topic Quiz

Check understanding

Answer all questions, then click Check answers. Use this before Practice in the editor.

Q1. A DataFrame is…

Q2. Filtering rows usually uses…

Q3. groupby is for…

Q4. Pandas builds on…

Score: —