• Post author:
  • Post category:Pandas
  • Post last modified:March 27, 2024
  • Reading time:24 mins read
You are currently viewing Install Pandas on Windows Step-by-Step

You can install the Python pandas latest version or a specific version on windows either using pip command that comes with Python binary or conda if you are using Anaconda distribution. Before using either of these commands, you need to install Python or Anaconda distribution. If you already have either one installed, you can skip the document’s first section and directly jump to installing pandas. If not let’s see how to install pandas using these two approaches. You can use either one.

Related: Install pandas Using pip or conda on Linux & Mac OS

  • Conda is the package manager that comes with Anaconda distribution, It is a package manager that is both cross-platform and language agnostic.

Table of Contents

1. Install Python Pandas On Windows

As I said above if you already have python installed and have set the path to run python and pip from the command prompt, you can skip this section and directly jump to Install pandas using-pip-command-on-windows.

1.1 Download & Install Python

Let’s see step-by-step how to install python and set environment variables.

1.1.1 Download Python

Go to https://www.python.org/downloads/ and download the latest version for windows. If you want a specific version then use Active Python Releases section or scroll down to select the specific version to download.

python pandas installation
Python Download

This downloads the .exe file to your downloads folder.

1.1.2 Install Python to Custom Location

Now double click on the download to install it on windows. This will give you an installer screen similar to below.

From the below screen, you can select “Install Now” option if you wanted to install to the default location or select “Customize installation” to change the location where to install Python. In my case, I use the second option and installed at c:\apps\opt\python folder.

Note: Select the check box bottom of the screen that reads “Add Python 3.9 to PATH”. This adds the python location to the PATH environment variable so that you can run pip and python from the command line. In case if you do not select, don’t worry I will show you how to add python installation location to PATH post-installation.

Python pandas custom installation

1.1.3 Set Python Installed Location to PATH Environment

Now set the Python installed location and scripts locations (C:\apps\opt\Python\Python39;C:\apps\opt\Python\Python39\Scripts) to PATH environment variables by following the below images in order.

1.1.4 Run Python shell from Command Prompt

Now open the windows command prompt by entering cmd from windows run ( Press windows icon + R) or from the search command

install pandas windows

This opens the command prompt. Now type python and press enter, this should give you a python prompt.

In case if you get an error like "'python' is not recognized as an internal or external command" then something wrong with your PATH environment variable from the above step. Correct it and re-open the command line and try python again. If you still get an error then try setting PATH from the command prompt by running the below command. Change paths according to your installation.


set PATH=%PATH%;C:\apps\opt\Python\Python39;C:\apps\opt\Python\Python39\Scripts;

Now type again python and confirm you are seeing the below message.

pandas install command prompt

1.2 Install Pandas Using pip Command on Windows

Python that I have installed comes with pip and pip3 commands (You can find these in the python installed folder @ C:\apps\opt\Python\Python39\Scripts.

pip (Python package manager) is used to install third-party packages from PyPI. Using pip you can install/uninstall/upgrade/downgrade any python library that is part of Python Package Index.

Since the pandas package is available in PyPI, we should use this to install pandas latest version on windows.


# Install pandas using pip
pip install pandas
(or)
pip3 install pandas

This should give you output as below. If your pip is not up to date, then upgrade pip to the latest version.

Install pandas pip windows

To check what version of pandas installed use pip list or pip3 list commands.

show pandas install version

If you want to install a specific version of pandas, use the below command


# Installing pandas to specific version
pip install pandas==1.3.1

In case if you wanted to upgrade pandas to the latest or specific version


# Using pip3 to upgrade pandas
pip3 install --upgrade pandas

# Alternatively you can also try
python -m pip install --upgrade pandas

This completes the installation of pandas to the latest or specific version on windows. If you have trouble installing or any steps are incorrect here, please comment. Your comment would help others !!

2. Install Pandas From Anaconda Distribution

If you already have Anaconda install then jump to Install pandas using conda command on Windows

2.1 Download & Install Anaconda distribution

Follow the below step-by-step instructions to install Anaconda on windows.

2.1.1 Download Anaconda .exe File

Go to https://anaconda.com/ and select Anaconda Individual Edition to download the latest version of Anaconda. This downloads the .exe file to the windows default downloads folder.

anaconda pandas window install

2.1.2 Install Anaconda on Windows

By double-clicking the .exe file starts the Anaconda installation. Follow the below screen shot’s and complete the installation

First step pandas installation
installing pandas setp-by-step
install pandas all users
complete anaconda pandas installation

This finishes the installation of the Anaconda distribution. Now let’s see how to install pandas.

2.2 Install Pandas using conda command on Windows

2.2.1 Open Anaconda Navigator from the windows start or search box.

2.2.2 Create Anaconda Environment

This is optional but recommended to create an environment before you proceed. This gives complete segregation of different package installs for different projects you would be working on. If you already have an environment, you can use it too.

Select + Create option -> select the Python version you would like to use and enter your environment name. I am using the environment as pandas-tutorial.

2.2.3 Open Anaconda Terminal

You open the Anaconda terminal from Anaconda Navigator or open it from the windows start menu/search.

create pandas environment

2.2.4 Install Pandas using conda

Now enter conda install pandas to install pandas in your environment. Note that along with pandas it also installs several other packages including the most used numpy.

install pandas conda windows

2.2.5 Test Pandas From Command Line or Using Jupyter Notebook

now open Python terminal by entering python on the command line and then run the following command at prompt >>>.


>>> import pandas as pd
>>> pd.__version__
'1.3.2'
>>>
Run Pandas statements

Writing pandas commands from the terminal is not practical in real-time, so let’s see how to run panda programs from Jupyter Notebook.

Go to Anaconda Navigator -> Environments -> your environment (mine pandas-tutorial) -> select Open With Jupyter Notebook

install anaconda pandas windows

This opens up Jupyter Notebook in the default browser.

Open Jupyter Notebook

Now select New -> PythonX and enter the below lines and select Run.

Run pandas jupyter windows

This completes installing pandas on Anaconda and running sample pandas statements on the command line and Jupyter Notebook.

I have tried my best to cover each step, if you notice I missed any step or If you have trouble installing, please comment. Your comment would help others !!

Happy Learning !!

Frequently Asked Questions on Install Pandas on Windows Step-by-Step

How do I install Pandas on Windows?

Installing Pandas on Windows is straightforward. You can use the following steps:
Open a command prompt or Anaconda prompt.
Run the command: pip install pandas

What are the prerequisites for installing Pandas on Windows?

Before installing Pandas, ensure that you have Python installed on your Windows machine. You can download and install Python from the official Python website (https://www.python.org/).

Can I install Pandas using a virtual environment on Windows?

It’s recommended to use a virtual environment to manage dependencies. You can create a virtual environment, activate it, and then install Pandas using the provided steps.

Are there alternative methods to install Pandas on Windows?

If you are using Anaconda, you can install Pandas through the Anaconda Navigator or Anaconda prompt. Additionally, you can use other package managers like conda for installation.

What do I do if I encounter installation errors on Windows?

If you encounter any installation errors, check that your Python environment is correctly set up, and ensure that you have the necessary permissions to install packages. You may also consider using a virtual environment to isolate your project dependencies.

Can I install specific versions of Pandas on Windows?

You can install a specific version of Pandas by specifying the version number in the installation command. For example, pip install pandas==1.3.3 installs Pandas version 1.3.3.

Related Articles

Naveen Nelamali

Naveen Nelamali (NNK) is a Data Engineer with 20+ years of experience in transforming data into actionable insights. Over the years, He has honed his expertise in designing, implementing, and maintaining data pipelines with frameworks like Apache Spark, PySpark, Pandas, R, Hive and Machine Learning. Naveen journey in the field of data engineering has been a continuous learning, innovation, and a strong commitment to data integrity. In this blog, he shares his experiences with the data as he come across. Follow Naveen @ LinkedIn and Medium

Leave a Reply

This Post Has 2 Comments

  1. Rahman

    oh man, thank you for your tutor

  2. Anonymous

    Thank you so much spark by ,its very helpfull