Thanks to theidioms.com

Installing and Importing Pandas

Pandas course
Tutorial

Installing and Importing Pandas


In this lesson, you will learn about Pandas along with how to install and import it in Python. You will also learn how to check the version of the installed Pandas library.


What is Pandas?

Pandas Logo - What is Pandas?

Pandas is an open-source python package widely used for data manipulation and analysis. It is built on top of the Numpy library and it provides flexible data structures for manipulating numerical tables and time series. Pandas is easy to use, fast and efficient. It is well suited to work with:

  1. Tabular Data (SQL/Excel spreadsheet)
  2. Ordered and Unordered Time series data
  3. Arbitrary matrix data
  4. Other observational and statistical datasets

Pandas can handle the majority of data used in finance, statistics, the various field of engineering. This has the library popular among people of various domains. It allows importing data from various file formats like comma-separated values (CSV), JSON, Excel, SQL, and much more. It can also handle various data manipulation operations like merging, reshaping, data cleaning, and data wrangling.


How to install Pandas in Python?

Before installing Pandas, make sure you have an updated version of Python installed on your device. If not, you may learn how to do so from this article on installing Python.

Once Python is installed, Pandas can be installed using the Python Package Manager, pip, as follows:

pip install pandas
Installing and Importing Pandas

Note: If you are using Anaconda, Pandas comes pre-installed.


How to import Pandas in Python?

Starting from this section onwards in this course, we will be using Jupyter Notebooks as our Python IDLE. If you do not have Jupyter Notebook installed, you can follow this guide to install and learn more about it.

To import Pandas in Python and check the currently installed version, write the following code in a new cell of Jupyter Notebook and run it (shift+enter):

# Library import convention
import pandas as pd 

# Check version of pandas installed
print(pd.__version__)

If your Pandas version is greater than 1.0.0, then everything is now ready!

Note that, by writing the line, import pandas as pd, we are importing the pandas library under a variable name pd. Here, pd is just an arbitrary import name used by convention and is similar to how np is used for numpy. This is just to maintain uniformity.


Now that you’ve installed Pandas and imported it in Python, head over to the next chapter where you will learn about one of the fundamental data structures used in Pandas called a Pandas Series.

Leave your thought here

Your email address will not be published. Required fields are marked *