Skip to content

Introduction to Pandas

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.

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

Install pandas with pip
pip install pandas
Install pandas with pip
pip install pandas

Install with conda

Install pandas with conda
conda install pandas
Install pandas with conda
conda install pandas

Your first Pandas import

Import pandas
import pandas as pd
 
print(pd.__version__)
Import pandas
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

diagram From raw data to insight mermaid
Pandas sits between messy raw sources and the analysis you actually want to do.

🧪 Try It Yourself

Exercise 1 – Import Pandas and Check the Version

Exercise 2 – Create Your First Series

Exercise 3 – Build a DataFrame From a Dict

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.

If this helped you, consider buying me a coffee ☕

Buy me a coffee

Was this page helpful?

Let us know how we did