Установка¶
Проще всего установить pandas в составе Anaconda — кроссплатформенного дистрибутива для анализа данных и научных вычислений. Это рекомендуемый метод установки для большинства пользователей.
Здесь вы также найдете инструкции по установке из исходников, с помощью PyPI, ActivePython, различных дистрибутивов Linux и версию для разработки.
Поддержка версий Python¶
Официально поддерживается Python 3.8, 3.9 и 3.10.
Установка pandas¶
Установка с помощью Anaconda¶
Установка pandas и остальной части стека NumPy и SciPy может быть немного сложной для неопытных пользователей.
Проще всего установить не только pandas, но и Python и самые популярные пакеты, составляющие стек SciPy (IPython , NumPy, Matplotlib и так далее) с использованием Anaconda — кроссплатформенного (Linux, macOS, Windows) дистрибутива Python для анализа данных и научных вычислений.
После запуска установщика пользователь получит доступ к pandas и остальной части стека SciPy без необходимости устанавливать что-либо еще и без необходимости ждать, пока какое-либо программное обеспечение будет скомпилировано.
Инструкции по установке Anaconda можно найти здесь.
Полный список пакетов, доступных в составе дистрибутива Anaconda, можно найти здесь.
Еще одним преимуществом установки Anaconda является то, что вам не нужны права администратора для ее установки. Anaconda может быть установлена в домашнем каталоге пользователя, что упрощает удаление Anaconda в случае необходимости (просто удалите эту папку).
Установка с помощью Miniconda¶
В предыдущем разделе было описано, как установить pandas в составе дистрибутива Anaconda. Однако этот подход означает, что вы установите более сотни пакетов и предполагает загрузку установщика, размер которого составляет несколько сотен мегабайт.
Если вы хотите иметь больший контроль над пакетами или пропускная способность интернета у вас ограничена, то установка pandas с помощью Miniconda может вам подойти лучше.
Conda — это менеджер пакетов, на котором построен дистрибутив Anaconda. Это менеджер пакетов, который является одновременно кроссплатформенным и независимым от языка (он похож на комбинацию pip и virtualenv).
Miniconda позволяет вам создать минимальную автономную установку Python, а затем использовать команды Conda для установки дополнительных пакетов (см. краткое руководство по Miniconda на русском).
Сначала вам нужно установить Conda, и загрузка и запуск Miniconda решит эту задачу. Установщик можно найти здесь.
Следующим шагом является создание новой среды conda. Виртуальная среда conda похожа на ту, которая создается virtualenv, она позволяет указать конкретную версию Python и набор библиотек. Запустите следующие команды из окна терминала:
Это создаст минимальную среду, в которой будет установлен только Python. Чтобы активировать эту среду, запустите:
В Windows команда следующая:
Последним шагом необходимо установить pandas. Это можно сделать с помощью следующей команды:
Установить определенную версию pandas:
Установить другие пакеты, например, IPython:
Установить полный дистрибутив Anaconda:
Если вам нужны пакеты, доступные для pip, но не для conda, установите pip, а затем используйте pip для установки этих пакетов:
Установка из PyPI¶
pandas можно установить через pip из PyPI.
У вас должен быть pip>=19.3 для установки из PyPI.
Установка с ActivePython¶
Инструкции по установке ActivePython можно найти здесь. Версии 2.7, 3.5 и 3.6 включают pandas.
Установка с помощью менеджера пакетов вашего дистрибутива Linux.¶
Команды в этой таблице установят pandas для Python 3 из вашего дистрибутива.
Ссылка на скачивание / репозиторий
Команда для установки
sudo apt-get install python3-pandas
нестабильный (последние пакеты)
sudo apt-get install python3-pandas
sudo apt-get install python3-pandas
zypper in python3-pandas
dnf install python3-pandas
yum install python3-pandas
Однако пакеты в менеджерах пакетов linux часто отстают на несколько версий, поэтому, чтобы получить новейшую версию pandas, рекомендуется устанавливать ее с помощью команд pip или conda , описанных выше.
Обработка ошибок импорта¶
Если вы столкнулись с ошибкой ImportError, это обычно означает, что Python не смог найти pandas в списке доступных библиотек. Внутри Python есть список каталогов, в которых он ищет пакеты. Вы можете получить список этих каталогов с помощью команды:
Одна из возможных причин ошибки — это если Python в системе установлен более одного раза, и pandas не установлен в том Python, который вы используете на текущий момент. В Linux/Mac вы можете запустить what python на своем терминале, и он сообщит вам, какой Python вы используете. Если это что-то вроде «/usr/bin/python», вы используете Python из системы, что не рекомендуется.
Настоятельно рекомендуется использовать conda для быстрой установки и обновления пакетов и зависимостей. Вы можете найти простые инструкции по установке pandas в этом документе.
Установка из исходников¶
Полные инструкции по сборке из исходного дерева git см. в Contributing guide. Если вы хотите создать среду разработки pandas, смотрите Creating a development environment.
Запуск набора тестов¶
pandas оснащен исчерпывающим набором модульных тестов, покрывающих около 97% кодовой базы на момент написания этой статьи. Чтобы запустить его на своем компьютере и удостовериться, что все работает (и что у вас установлены все зависимости, программные и аппаратные), убедитесь, что у вас есть pytest >= 6.0 и Hypothesis >= 3.58, затем запустите:
Installation#
The easiest way to install pandas is to install it as part of the Anaconda distribution, a cross platform distribution for data analysis and scientific computing. This is the recommended installation method for most users.
Instructions for installing from source, PyPI, ActivePython, various Linux distributions, or a development version are also provided.
Python version support#
Officially Python 3.8, 3.9, 3.10 and 3.11.
Installing pandas#
Installing with Anaconda#
Installing pandas and the rest of the NumPy and SciPy stack can be a little difficult for inexperienced users.
The simplest way to install not only pandas, but Python and the most popular packages that make up the SciPy stack (IPython, NumPy, Matplotlib, …) is with Anaconda, a cross-platform (Linux, macOS, Windows) Python distribution for data analytics and scientific computing.
After running the installer, the user will have access to pandas and the rest of the SciPy stack without needing to install anything else, and without needing to wait for any software to be compiled.
Installation instructions for Anaconda can be found here.
A full list of the packages available as part of the Anaconda distribution can be found here.
Another advantage to installing Anaconda is that you don’t need admin rights to install it. Anaconda can install in the user’s home directory, which makes it trivial to delete Anaconda if you decide (just delete that folder).
Installing with Miniconda#
The previous section outlined how to get pandas installed as part of the Anaconda distribution. However this approach means you will install well over one hundred packages and involves downloading the installer which is a few hundred megabytes in size.
If you want to have more control on which packages, or have a limited internet bandwidth, then installing pandas with Miniconda may be a better solution.
Conda is the package manager that the Anaconda distribution is built upon. It is a package manager that is both cross-platform and language agnostic (it can play a similar role to a pip and virtualenv combination).
Miniconda allows you to create a minimal self contained Python installation, and then use the Conda command to install additional packages.
First you will need Conda to be installed and downloading and running the Miniconda will do this for you. The installer can be found here
The next step is to create a new conda environment. A conda environment is like a virtualenv that allows you to specify a specific version of Python and set of libraries. Run the following commands from a terminal window:
This will create a minimal environment with only Python installed in it. To put your self inside this environment run:
On Windows the command is:
The final step required is to install pandas. This can be done with the following command:
To install a specific pandas version:
To install other packages, IPython for example:
To install the full Anaconda distribution:
If you need packages that are available to pip but not conda, then install pip, and then use pip to install those packages:
Installing from PyPI#
pandas can be installed via pip from PyPI.
You must have pip>=19.3 to install from PyPI.
Installing with ActivePython#
Installation instructions for ActivePython can be found here. Versions 2.7, 3.5 and 3.6 include pandas.
Installing using your Linux distribution’s package manager.#
The commands in this table will install pandas for Python 3 from your distribution.
Name already in use
pandas / doc / source / getting_started / install.rst
- Go to file T
- Go to line L
- Copy path
- Copy permalink
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
The easiest way to install pandas is to install it as part of the Anaconda distribution, a cross platform distribution for data analysis and scientific computing. This is the recommended installation method for most users.
Instructions for installing from source, PyPI, ActivePython, various Linux distributions, or a development version are also provided.
Python version support
Officially Python 3.8, 3.9, 3.10 and 3.11.
Installing with Anaconda
Installing pandas and the rest of the NumPy and SciPy stack can be a little difficult for inexperienced users.
The simplest way to install not only pandas, but Python and the most popular packages that make up the SciPy stack (IPython, NumPy, Matplotlib, . ) is with Anaconda, a cross-platform (Linux, macOS, Windows) Python distribution for data analytics and scientific computing.
After running the installer, the user will have access to pandas and the rest of the SciPy stack without needing to install anything else, and without needing to wait for any software to be compiled.
Installation instructions for Anaconda can be found here.
A full list of the packages available as part of the Anaconda distribution can be found here.
Another advantage to installing Anaconda is that you don’t need admin rights to install it. Anaconda can install in the user’s home directory, which makes it trivial to delete Anaconda if you decide (just delete that folder).
Installing with Miniconda
The previous section outlined how to get pandas installed as part of the Anaconda distribution. However this approach means you will install well over one hundred packages and involves downloading the installer which is a few hundred megabytes in size.
If you want to have more control on which packages, or have a limited internet bandwidth, then installing pandas with Miniconda may be a better solution.
Conda is the package manager that the Anaconda distribution is built upon. It is a package manager that is both cross-platform and language agnostic (it can play a similar role to a pip and virtualenv combination).
Miniconda allows you to create a minimal self contained Python installation, and then use the Conda command to install additional packages.
First you will need Conda to be installed and downloading and running the Miniconda will do this for you. The installer can be found here
The next step is to create a new conda environment. A conda environment is like a virtualenv that allows you to specify a specific version of Python and set of libraries. Run the following commands from a terminal window:
This will create a minimal environment with only Python installed in it. To put your self inside this environment run:
On Windows the command is:
The final step required is to install pandas. This can be done with the following command:
To install a specific pandas version:
To install other packages, IPython for example:
To install the full Anaconda distribution:
If you need packages that are available to pip but not conda, then install pip, and then use pip to install those packages:
Installing from PyPI
pandas can be installed via pip from PyPI.
You must have pip>=19.3 to install from PyPI.
pandas can also be installed with sets of optional dependencies to enable certain functionality. For example, to install pandas with the optional dependencies to read Excel files.
The full list of extras that can be installed can be found in the :ref:`dependency section.<install.optional_dependencies>`
Installing with ActivePython
Installation instructions for ActivePython can be found here. Versions 2.7, 3.5 and 3.6 include pandas.
Installing using your Linux distribution’s package manager.
The commands in this table will install pandas for Python 3 from your distribution.
| Distribution | Status | Download / Repository Link | Install method |
|---|---|---|---|
| Debian | stable | official Debian repository | sudo apt-get install python3-pandas |
| Debian & Ubuntu | unstable (latest packages) | NeuroDebian | sudo apt-get install python3-pandas |
| Ubuntu | stable | official Ubuntu repository | sudo apt-get install python3-pandas |
| OpenSuse | stable | OpenSuse Repository | zypper in python3-pandas |
| Fedora | stable | official Fedora repository | dnf install python3-pandas |
| Centos/RHEL | stable | EPEL repository | yum install python3-pandas |
However, the packages in the linux package managers are often a few versions behind, so to get the newest version of pandas, it’s recommended to install using the pip or conda methods described above.
If you encounter an ImportError, it usually means that Python couldn’t find pandas in the list of available libraries. Python internally has a list of directories it searches through, to find packages. You can obtain these directories with:
One way you could be encountering this error is if you have multiple Python installations on your system and you don’t have pandas installed in the Python installation you’re currently using. In Linux/Mac you can run which python on your terminal and it will tell you which Python installation you’re using. If it’s something like «/usr/bin/python», you’re using the Python from the system, which is not recommended.
It is highly recommended to use conda , for quick installation and for package and dependency updates. You can find simple installation instructions for pandas in this document: installation instructions </getting_started.html> .
Installing from source
See the :ref:`contributing guide <contributing>` for complete instructions on building from the git source tree. Further, see :ref:`creating a development environment <contributing_environment>` if you wish to create a pandas development environment.
Installing the development version of pandas
Installing a nightly build is the quickest way to:
- Try a new feature that will be shipped in the next release (that is, a feature from a pull-request that was recently merged to the main branch).
- Check whether a bug you encountered has been fixed since the last release.
You can install the nightly build of pandas using the scipy-wheels-nightly index from the PyPI registry of anaconda.org with the following command:
Note that first uninstalling pandas might be required to be able to install nightly builds:
Running the test suite
pandas is equipped with an exhaustive set of unit tests, covering about 97% of the code base as of this writing. To run it on your machine to verify that everything is working (and that you have all of the dependencies, soft and hard, installed), make sure you have pytest >= 7.0 and Hypothesis >= 6.34.2, then run:
This is just an example of what information is shown. You might see a slightly different result as what is shown above.
pandas requires the following dependencies.
| Package | Minimum supported version |
|---|---|
| NumPy | 1.20.3 |
| python-dateutil | 2.8.2 |
| pytz | 2020.1 |
pandas has many optional dependencies that are only used for specific methods. For example, :func:`pandas.read_hdf` requires the pytables package, while :meth:`DataFrame.to_markdown` requires the tabulate package. If the optional dependency is not installed, pandas will raise an ImportError when the method requiring that dependency is called.
If using pip, optional pandas dependencies can be installed or managed in a file (e.g. requirements.txt or pyproject.toml) as optional extras (e.g.,«pandas[performance, aws]>=1.5.0«). All optional dependencies can be installed with pandas[all] , and specific sets of dependencies are listed in the sections below.
Performance dependencies (recommended)
You are highly encouraged to install these libraries, as they provide speed improvements, especially when working with large data sets.
Installable with pip install «pandas[performance]»
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| numexpr | 2.7.3 | performance | Accelerates certain numerical operations by using uses multiple cores as well as smart chunking and caching to achieve large speedups |
| bottleneck | 1.3.2 | performance | Accelerates certain types of nan by using specialized cython routines to achieve large speedup. |
| numba | 0.53.1 | performance | Alternative execution engine for operations that accept engine=»numba» using a JIT compiler that translates Python functions to optimized machine code using the LLVM compiler. |
Installable with pip install «pandas[timezone]»
Allows the use of zoneinfo timezones with pandas. Note: You only need to install the pypi package if your system does not already provide the IANA tz database. However, the minimum tzdata version still applies, even if it is not enforced through an error.
If you would like to keep your system tzdata version updated, it is recommended to use the tzdata package from conda-forge.
Installable with pip install «pandas[plot, output_formatting]» .
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| matplotlib | 3.6.1 | plot | Plotting library |
| Jinja2 | 3.0.0 | output_formatting | Conditional formatting with DataFrame.style |
| tabulate | 0.8.9 | output_formatting | Printing in Markdown-friendly format (see tabulate) |
Installable with pip install «pandas[computation]» .
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| SciPy | 1.7.1 | computation | Miscellaneous statistical functions |
| xarray | 0.21.0 | computation | pandas-like API for N-dimensional data |
Installable with pip install «pandas[excel]» .
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| xlrd | 2.0.1 | excel | Reading Excel |
| xlsxwriter | 1.4.3 | excel | Writing Excel |
| openpyxl | 3.0.7 | excel | Reading / writing for xlsx files |
| pyxlsb | 1.0.8 | excel | Reading for xlsb files |
Installable with pip install «pandas[html]» .
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| BeautifulSoup4 | 4.9.3 | html | HTML parser for read_html |
| html5lib | 1.1 | html | HTML parser for read_html |
| lxml | 4.6.3 | html | HTML parser for read_html |
One of the following combinations of libraries is needed to use the top-level :func:`
-
and html5lib and lxml and html5lib and lxml
- Only lxml, although see :ref:`HTML Table Parsing <io.html.gotchas>` for reasons as to why you should probably not take this approach.
-
if you install BeautifulSoup4 you must install either lxml or html5lib or both. :func:`
Installable with pip install «pandas[xml]» .
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| lxml | 4.6.3 | xml | XML parser for read_xml and tree builder for to_xml |
Installable with pip install «pandas[postgresql, mysql, sql-other]» .
| Dependency | Minimum Version | pip extra | Notes |
|---|---|---|---|
| SQLAlchemy | 1.4.16 | postgresql, mysql, sql-other | SQL support for databases other than sqlite |
| psycopg2 | 2.8.6 | postgresql | PostgreSQL engine for sqlalchemy |
| pymysql | 1.0.2 | mysql | MySQL engine for sqlalchemy |
Other data sources
Installable with pip install «pandas[hdf5, parquet, feather, spss, excel]»
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 first you need to have Python or Anaconda distribution installed. If you already have either one installed then you can skip the first section of the document and directly jump to installing pandas. if not let’s see how to install pandas using these two approaches. You can use either one.
-
command that comes with python 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.
-
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.
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.

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

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.
Now type again python and confirm you are seeing the below message.

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.
This should give you output as below. If your pip is not up to date, then upgrade pip to the latest version.

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

If you want to install a specific version of pandas, use the below command
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.

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








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.


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 .

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 >>>.

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

This opens up Jupyter Notebook in the default browser.

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

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 !!