How to update Pandas in PIP, Anaconda, Poetry

To update Pandas to a specific or to a latest version you need to check next steps:

Steps to update Pandas

  • Activate the environment for Pandas
  • Check how Pandas was installed
    • Pip
    • Anaconda
    • Poetry
  • Check current Pandas version - optional
  • Upgrade Pandas to
    • specific version
    • latest version

Step 2. Check how Pandas was installed

To start you need to know how Pandas is installed and where. The simplest but not best way is to check which command is working for you:

To list packages in Pip virtual environment

pip list

or to check for Anaconda environment - get a list of all conda environments

conda info --envs

To check Poetry environment use:

poetry show --latest

There is a good extra reading on the topic here with best practices: Using Pip in a Conda Environment

Step 3. Check current Pandas version

To check which is the current Pandas version you can use:

3.1. Check Pandas version by PIP

!pip list | grep pandas

which will show something like:

pandas                            1.4.0

or the more detailed information by:

!pip show pandas
Name: pandas
Version: 1.4.0
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: https://pandas.pydata.org
Author: The Pandas Development Team
Author-email: pandas-dev@python.org
License: BSD-3-Clause
Location: /home/user/Software/Tensorflow/environments/venv38/lib/python3.8/site-packages
Requires: numpy, python-dateutil, pytz
Required-by: altair, bar-chart-race, calmap, calplot, dataframe-image, geopandas, holoviews, ibis-framework, itables, modin, pyLDAvis, qgrid, seaborn, statsmodels, swifter, tabula-py
Note: you may need to restart the kernel to use updated packages

3.2. Check current Pandas version in Conda

To check which is the installed Pandas version in Conda use the following:

conda list pandas

To find all available versions use:

conda search pandas

3.3. Check Pandas package in poetry

poetry show pandas

result:

name : pandas
version : 1.4.0

4. Update Pandas

4.1. Update Pandas with Pip

To install specific version of Pandas by Pip use this format:

pip install pandas==1.3.2

and for upgrade to the latest version use:

pip install --upgrade pandas

4.2. Update Pandas in Conda

To install specific version of Pandas with Anaconda use this format:

conda install pandas=1.0.2

and for update to the latest version use:

conda install pandas

4.3. Update Pandas in Poetry

To update Pandas to the latest version in Poetry you can use:

poetry update pandas

for a specific version use:

poetry add pandas="1.3.2"

Depending on the .toml file different versions can be installed. To read more about poetry follow this link: Poetry update