How to Instal Python Data Analysis Libray - Pandas

Post Reply
User avatar
Eli
Senior Expert Member
Reactions: 189
Posts: 5943
Joined: 10 years ago
Location: Tanzania
Contact:

#1

Pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language. Pandas is a Python library that makes working with data a seamlessly simple task.

Installing pandas, just like the NumPy and SciPy stack can be a little trickier for inexperienced users. 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. Installing with Anaconda will not only install pandas, but will also install Python and the most popular packages for scientific computing that make up the SciPy stack, such as IPython, NumPy, Matplotlib, and so on. See a full list of the packages available as part of the Anaconda distribution here . Anaconda is a cross-platform distribution, installable to Linux, Mac OS X and Windows.

After running Anaconda installer, you will have access to pandas and the rest of the SciPy stack without a need to install anything else, and without needing to wait for any software to be compiled. Installation instructions for Anaconda using bash script can be found here: install-python-anaconda-and-use-ipython-notebbok-4377

Installing with Anaconda does not require any admin privileges, its installation goes to the user’s home directory. This way of installing has a great advantage as it makes it easy to get rid of Anaconda, if you no longer need it at a later time by simply deleting the Anaconda folder.

If you are not interested in installing pandas via Anaconda distribution, you can simply install it by using conda:

Code: Select all

conda install pandas
You can as well install a specific pandas version:

Code: Select all

conda install pandas=0.22.0
Conda (a mini version of Anaconda that includes only conda and its dependencies) is the package manager on which the Anaconda distribution is built upon, and it is both cross-platform and independent of any specific programming language. Conda plays a similar role to a pip and virtual environment (virtualenv) combined.

Note that you need to install Miniconda in order to be able to use conda, go to https://conda.io/docs/user-guide/install/index.html and install it.

We can then install pandas and other packages using Miniconda. This is the best way to install packages if you need more control in managing them, or if you are running under a limited internet bandwidth. Miniconda allows users to create a minimal self contained Python installation, and then use the conda command to install additional packages as deems fit.

To use Miniconda, we will need to create a conda environment. This is analogous to Python virtualenv. Just like Python virtualenv, conda allows you to specify precisely which Python version to install/use with.

Now, to create a new conda environment, run the following command in the Terminal window:

Code: Select all

conda create -n name_of_your_env python
The above command creates a minimal environment with only default Python 2 installed within it.

To create a minimal environment for Python 3, you just need to specify the Python version:

Code: Select all

conda create -n name_of_your_env python3
To activate this conda environment run:

Code: Select all

source activate name_of_your_env
If you are using Windows operating system, for conda environment activation, run

Code: Select all

activate name_of_your_env
instead.

Finally, after creating and putting yourself inside the conda environment, you can install pandas and many other packages, such as Ipython, pip, etc., respectively, by running the below commands.

Install pandas:

Code: Select all

conda install pandas
Install Ipython:

Code: Select all

conda install ipython
Install pip:

Code: Select all

conda install pip
You can even install a full Anaconda distribution:

Code: Select all

conda install anaconda

pandas can be installed via pip from PyPI. Just like you can install any other packages that are available to pip but not conda, first install pip (for example via Miniconda as we have seen above) and use it to install other packages (see examples here):

Install pandas with pip:

Code: Select all

pip install pandas
or

Code: Select all

pip3 install pandas
for Python 3.

Install Django:

Code: Select all

pip install django

There are a lot of options to install pandas. You can install pandas for Python 3 from your distribution, for example, to install pandas for Ubuntu, Debian, Linux Mint, run:

Code: Select all

sudo apt-get install python3-pandas

To install pandas on other Linux-based distributions;

OpenSuse:

Code: Select all

zypper in  python3-pandas
Fedora:

Code: Select all

dnf install python3-pandas
Centos/RHEL:

Code: Select all

yum install python3-pandas

To install pandas for Python 2, use the package python-pandas.

The packages in the Linux package managers may in most cases be few versions behind the newest releases, so to get the newest version of pandas, it’s recommended to install using the pip or conda methods described above.

Find out more about Pandas:

http://pandas.pydata.org/pandas-docs/st ... ntributing
http://pandas.pydata.org/pandas-docs/st ... ng-dev-env
0
TSSFL -- A Creative Journey Towards Infinite Possibilities!
Post Reply

Return to “Linux and Unix Based Operating Systems”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests