Last updated

Pandas Introduction

Definition: Pandas is the most popular Python library for working with structured data — the kind you find in spreadsheets, CSV files, and databases. It lets you load, clean, filter, and analyse tables with just a few lines of code.

If you have ever used Excel, Pandas will feel familiar — but it is far more powerful and can handle millions of rows. It is built on top of NumPy and is the everyday tool of data analysts and data scientists.

The two core objects

  • Series — a single column of data (1D)
  • DataFrame — a full table of rows and columns (2D)

Your first DataFrame

import pandas as pd
data = {
  "name": ["Sam", "Alex", "Jo"],
  "age":  [25, 30, 22]
}
df = pd.DataFrame(data)
print(df)

A DataFrame prints as a neat table, with an automatic row index (0, 1, 2) on the left.

💡 Note: Pandas is imported as pd by convention. It loads on the first Run (a few seconds), then stays fast.

Try it Yourself
Output

          
Ad · responsive