What is Pandas?
Pandas is a Python library for working with structured data.
It gives you two core data structures:
- Series: a 1‑dimensional labeled array (like a single column)
- DataFrame: a 2‑dimensional labeled table (like a spreadsheet / SQL table)
Pandas is built on top of NumPy, so many NumPy concepts (like arrays, vectorization, and missing values) show up again here. As Wes McKinney (the creator of Pandas) puts it, NumPy is best for homogeneous numeric arrays, while Pandas is built specifically for tabular, heterogeneous data — the messy, real-world tables you get from spreadsheets, databases, and APIs.
Why Pandas is so popular in Data Analytics
In real data work, you spend a lot of time:
- Reading data from CSV/Excel/JSON/APIs
- Cleaning messy values
- Handling missing data
- Filtering and transforming rows/columns
- Aggregating data into summaries
- Preparing datasets for visualization and machine learning
Pandas is designed for exactly this.
When (not) to use Pandas
Pandas is great for:
- Small-to-medium datasets that fit in memory
- Exploratory analysis
- Data cleaning and feature engineering
Pandas may not be ideal for:
- Huge datasets that don’t fit in memory (use DuckDB/Polars/Spark)
- Highly-parallel compute workloads
Installing Pandas
If you already installed libraries in Phase 1, you probably have it.
Install with pip
pip install pandasInstall with conda
conda install pandasYour first Pandas import
import pandas as pd
print(pd.__version__)Quick mental model: DataFrame thinking
A DataFrame is basically:
- Rows (observations / records)
- Columns (features / fields)
Common questions you’ll ask:
- What columns do I have?
- How many rows?
- Are there missing values?
- How do I filter rows?
- How do I compute group summaries?
We’ll answer all of these in this phase.
Visualize it
flowchart LR A["CSV / Excel / JSON / API"] --> B["pandas.DataFrame"] B --> C["Clean & transform"] C --> D["Group & aggregate"] D --> E["Visualize / Model"]
🧪 Try It Yourself
Exercise 1 – Import Pandas and Check the Version
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Exercise 2 – Create Your First Series
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Exercise 3 – Build a DataFrame From a Dict
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Check your understanding
What are the two core pandas data structures?
A Series is a 1-dimensional labeled array like a single column, and a DataFrame is a 2-dimensional labeled table.
Show answer
A — Series and DataFrame — A Series is a 1-dimensional labeled array like a single column, and a DataFrame is a 2-dimensional labeled table.
On what library is pandas built?
Pandas is built on top of NumPy, so arrays, vectorization and missing values carry over.
Show answer
A — NumPy — Pandas is built on top of NumPy, so arrays, vectorization and missing values carry over.
For which situation does the lesson suggest looking beyond pandas?
Pandas suits small-to-medium data that fits in memory. For larger data the lesson mentions DuckDB, Polars or Spark.
Show answer
A — Huge datasets that do not fit in memory — Pandas suits small-to-medium data that fits in memory. For larger data the lesson mentions DuckDB, Polars or Spark.
What do you run to check which pandas version is installed?
The lesson imports pandas as pd and prints pd.__version__.
Show answer
A — print(pd.__version__) after import pandas as pd — The lesson imports pandas as pd and prints pd.__version__.
Next
Now that you know what Pandas is and why it matters, move on to Series and DataFrames to build and inspect these structures in more depth.