How to install pandas in Python
Short answer: Open a terminal and run python -m pip install pandas on Windows or python3 -m pip install pandas on macOS and Linux, ideally inside a virtual environment. In Jupyter, type %pip install pandas in a cell. The latest version is pandas 3.1.1, released on November 4, 2026, and it needs Python 3.11 or newer. Check the install with python -c "import pandas as pd; print(pd.__version__)".
pandas is the Python library for working with tables of data: reading CSV and Excel files, cleaning columns, filtering rows and calculating summaries. It does not come with Python, so you install it with pip, the package installer.
pip installs pandas together with numpy and python-dateutil, the libraries it needs. Inside a virtual environment you never touch the system Python.
Installing pandas at a glance
| Where you work | Command |
|---|---|
| Windows terminal | python -m pip install pandas |
| macOS or Linux terminal | python3 -m pip install pandas |
| Active virtual environment | pip install pandas |
| Jupyter Notebook or JupyterLab | %pip install pandas |
| Anaconda or Miniconda | conda install -c conda-forge pandas |
| uv project | uv add pandas |
| With Excel support | pip install "pandas[excel]" |
Step 1: check Python and pip
pandas 3.1 works with Python 3.11 or newer. Check your version:
python --version # Windows
python3 --version # macOS and Linux
python -m pip --version # pip, with python3 on macOS and LinuxIf you do not have Python or your version is older than 3.11, first follow the guide to install Python.
Step 2: create a virtual environment
A virtual environment keeps pandas inside your project folder. On Ubuntu, Debian and macOS with Homebrew it is almost required, because pip refuses to install packages into the system Python.
On Windows, in PowerShell:
python -m venv .venv
.venv\Scripts\activateOn macOS and Linux:
python3 -m venv .venv
source .venv/bin/activateYou will see (.venv) at the start of the line. From here on, python and pip belong to the environment.
Step 3: install pandas
pip install pandaspip downloads pandas and the libraries it needs. The last line confirms what was installed:
Successfully installed numpy-2.5.4 pandas-3.1.1 python-dateutil-4.0.0 tzdata-2026.6Step 4: check that it works
Create a file called test_pandas.py with this code and run it with python test_pandas.py:
import pandas as pd
print(pd.__version__)
df = pd.DataFrame({"product": ["Coffee", "Tea", "Water"], "price": [2.5, 2.0, 1.0]})
print(df)
print(df["price"].mean())3.1.1
product price
0 Coffee 2.5
1 Tea 2.0
2 Water 1.0
1.8333333333333333import pandas as pd is the usual way to import it, and pd is the name you will see in every example and in the documentation.
