How to Install pandas in Python
Powerful data structures for data analysis, time series, and statistics
pip install pandas
What is pandas?
Powerful data structures for data analysis, time series, and statistics
pandas: A Powerful Python Data Analysis Toolkit
pandas is a Python package that provides fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical, real-world data analysis in Python. Additionally, it has the broader goal of becoming the most powerful and flexible open-source data analysis/manipulation tool available in any language. It is already well on its way towards this goal.
- Main Features - Where to get it - Dependencies - Installation from sources - License - Documentation - Background - Getting Help - Discussion and Development - Contributing to pandas
Quick Start
Minimal example to get started with pandas:
import pandas as pd
df = pd.DataFrame({"name": ["Alice", "Bob"], "age": [30, 25]})
print(df)
print(df["age"].mean()) # 27.5
# Read from CSV
# df = pd.read_csv("data.csv")
Installation
pip (standard)
pip install pandas
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install pandas
pip3
pip3 install pandas
conda
conda install -c conda-forge pandas
Poetry
poetry add pandas
Dependencies
Installing pandas will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import pandas; print(pandas.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing pandas with pip.
ModuleNotFoundError: No module named 'pandas'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install pandas. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'pandas' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install pandas to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'pandas'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show pandas and upgrade with pip install --upgrade pandas.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install pandas. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user pandas
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pandas
MemoryError when loading data
Cause: Dataset is too large to fit in RAM.
Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.
Runtime Errors
Common errors when using pandas after installation.
KeyError: 'column_name'
Cause: The column does not exist in the DataFrame.
Fix: Inspect columns with df.columns.tolist(). Watch for leading/trailing whitespace in column names.
ValueError: Cannot convert float NaN to integer
Cause: The column contains NaN values but is being cast to int.
Fix: Fill or drop NaN values first: df['col'].fillna(0).astype(int)
MemoryError
Cause: The dataset is too large to fit in RAM.
Fix: Use chunked reading: pd.read_csv(file, chunksize=10000) or switch to Polars or Dask.
pandas.errors.ParserError: Error tokenizing data
Cause: Inconsistent column counts or wrong delimiter in the CSV.
Fix: Try pd.read_csv(file, on_bad_lines='skip') or specify sep=',' explicitly.
Recent Releases
| Version | Released |
|---|---|
3.0.2 latest |
2026-03-31 |
3.0.1 |
2026-02-17 |
3.0.0 |
2026-01-21 |
3.0.0rc2 |
2026-01-14 |
3.0.0rc1 |
2025-12-19 |
Manage pandas
Upgrade to latest version
pip install --upgrade pandas
Install a specific version
pip install pandas==3.0.2
Uninstall
pip uninstall pandas
Check what is installed
pip show pandas