You can upgrade Pandas to the latest version or to a specific version in several ways on windows or Linux depending on how you wanted to update. You can either use
pip install command to upgrade the version of the python package (in this case pandas) or if you are using conda you can use
conda install to upgrade Pandas.
Note: If you already have a Pandas version installed and you getting errors while upgrading to a higher version, sometimes uninstalling the existing version may resolve the issue. you can use
sudo pip uninstall pandas to uninstall on a Linux server. Install the latest pandas version on windows if you don’t have it.
1. Upgrade Pandas to Latest Version Using Pip
If you are using pip, you can upgrade Pandas to the latest version by issuing the below command. If you are not aware, PIP is a package management system used to install and manage software packages written in Python
You can run this pip command either from the Linux shell, Windows command tool or from the Anaconda command prompt to upgrade python packages.
Note: On windows make sure you have administrator access in order to run this command. On Linux make sure you have
sudo access to root.
# Using pip3 to upgrade pandas pip3 install --upgrade pandas # Alternatively you can also try python -m pip install --upgrade pandas
If you don’t have PATH setup for python/pip, you will get an error; so make sure you have PATH set-up on Linux and on Windows to run pip commands.
The above command upgraded my Pandas version to 1.3.1 on my laptop which is the latest version at the time of writing this article.
On Linux, if you get an access issue, run by adding
sudo to suffix like
sudo pip3 install --upgrade pandas.
2. Upgrade Pandas to Specific Version
In case if you do not want the latest version instead you wanted to upgrade to a specific version, you can do this using the below command. If you are eventually planning to upgrade the production system to a specific version, make sure the version you are upgrading doesn’t have any security issues and is stable.
# Upgrade to specific version pip install pandas==specific-higher-version
3. Check Pandas Version From Command Line
By using the below command you can check the Pandas upgraded version from the command line.
# List all packages pip3 list
As you see above list, Pandas has upgraded to 1.3.1 version.
4. Upgrade Pandas Version using Conda (Anaconda)
If you are using Anaconda distribution, you can use
conda install to upgrade Pandas to the latest version.
# Using conda install conda install -c anaconda pandas
Alternatively, you can also upgrade using
conda update command.
# Use conda update conda update pandas
To upgrade Pandas to a specific version
# Upgrade to specific version of pandas conda update pandas==0.14.0
In this article, you have learned how to upgrade to the latest version or to a specific version using pip and conda commands. Note that to install Pandas, you may need access to windows administration or Unix sudo to root access.
Happy Learning !!
You May Also Like Reading
- How to Get Installed Pandas Version and It’s Dependencies Package Versions?
- How to use Series with Examples.
- Different Ways to Rename Pandas DataFrame Column Names
- How to transform or remap Pandas DataFrame column values with Dict