100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Python

What Is Pandas?

An introduction to pandas, the Python library built on NumPy for labeled, tabular data manipulation, covering its core data structures and why it dominates real-world data analysis.

Pandas FoundationsBeginner7 min readJul 8, 2026
Analogies

What Is Pandas?

Pandas is an open-source Python library, built on top of NumPy, designed for working with structured and labeled data — the kind you would normally find in a spreadsheet, a SQL table, or a CSV file. Where a raw NumPy array is a grid of homogeneous numbers indexed only by integer position, pandas introduces two labeled data structures, Series and DataFrame, that carry row and column labels alongside the data itself, along with heterogeneous column types (numbers, strings, dates, categories) in a single table. This labeling is what makes pandas the workhorse of real-world data analysis: you can select 'the revenue column for March 2026' by name instead of remembering which integer index it happens to occupy, and pandas will automatically align data by label when you combine multiple datasets.

🏏

Cricket analogy: Pandas is like a scorecard that lets you select 'Kohli's strike rate in the third over' by name instead of remembering which row number it sits on, and it aligns two scorecards by player name automatically when merging them.

Why Pandas Exists Alongside NumPy

NumPy is optimized for fast numerical computation on homogeneous n-dimensional arrays, but most real datasets are messier: they mix strings, numbers, missing values, and dates, and they need to be joined, grouped, filtered, and reshaped based on meaningful labels rather than raw array positions. Pandas fills that gap by wrapping NumPy arrays (one per column, historically referred to as 'blocks') with an index, column names, and a rich API of relational-style operations — merges, joins, group-by aggregations, pivot tables — that mirror what you would do in SQL or Excel, but programmatically and reproducibly. Under the hood pandas still leans on NumPy's vectorized operations for performance, so understanding NumPy fundamentals (dtypes, broadcasting, vectorization) directly improves how you write efficient pandas code.

🏏

Cricket analogy: NumPy handles fast numerical crunching of raw ball-by-ball speeds, but real match data mixes venue names, weather notes, and dates, so pandas wraps that NumPy data with labels to support merges like combining batting and bowling scorecards.

The Two Core Data Structures

A Series is a one-dimensional labeled array — think of it as a single column with an index attached. A DataFrame is a two-dimensional labeled table made up of multiple Series that share the same index, each column potentially holding a different dtype (integers, floats, strings, datetimes, booleans, or categoricals). Every DataFrame column, when selected on its own (e.g. df['price']), returns a Series, which is why fluency with Series operations transfers directly to working with individual DataFrame columns.

🏏

Cricket analogy: A Series is like a single column of a scorecard - just the run tally with player names attached - while a DataFrame is the full scorecard combining batting, bowling, and fielding columns that all share the same player index.

python
import pandas as pd

data = {
    'product': ['Widget', 'Gadget', 'Gizmo'],
    'price': [19.99, 34.50, 12.75],
    'in_stock': [True, False, True],
}
df = pd.DataFrame(data)
print(df)
#   product  price  in_stock
# 0  Widget  19.99      True
# 1  Gadget  34.50     False
# 2   Gizmo  12.75      True

print(type(df['price']))   # <class 'pandas.core.series.Series'>
print(df.dtypes)
# product      object
# price       float64
# in_stock       bool
# dtype: object

Pandas takes its name from 'panel data', an econometrics term for datasets that combine cross-sectional and time-series observations — reflecting its original purpose of making financial and economic data analysis in Python practical.

What Pandas Is Commonly Used For

In practice, pandas is the glue between raw data sources (CSV files, databases, APIs, Excel workbooks) and downstream analysis or machine learning: reading and cleaning data, handling missing values, converting types, filtering rows with boolean conditions, grouping and aggregating, reshaping between wide and long formats, and exporting results. Its tight integration with NumPy means numeric columns can be fed directly into libraries like scikit-learn or PyTorch once cleaned, making pandas the de facto first stage of nearly every Python data pipeline.

🏏

Cricket analogy: Pandas is the glue between raw scoresheets, ball-tracking feeds, and video logs and downstream analytics, cleaning missing overs, filtering by team, and aggregating a bowler's stats before feeding numbers into a performance model.

A common beginner misconception is that pandas DataFrames are just 'Excel in Python'. They are much more powerful for reproducibility and scale — but unlike a spreadsheet, most operations return new objects rather than modifying data in place by default, which affects how you should write pandas code (assign results rather than assuming mutation).

  • Pandas builds on NumPy to add labeled, heterogeneous, tabular data structures: Series and DataFrame.
  • A Series is a 1-D labeled array; a DataFrame is a 2-D table of columns, each a Series, sharing an index.
  • Pandas automatically aligns data by label, not by raw position, when combining datasets.
  • Most pandas operations return new objects rather than mutating in place unless you explicitly reassign or use inplace=True.
  • Pandas is the standard bridge between messy real-world data sources and clean numeric arrays used by ML/analysis libraries.
  • DataFrame columns can each hold a different dtype, unlike a raw NumPy array which is homogeneous.

Practice what you learned

Was this page helpful?

Topics covered

#Python#PandasNumPyStudyNotes#DataScience#WhatIsPandas#Pandas#Exists#Alongside#NumPy#StudyNotes#SkillVeris