Python Pandas
Pandas
What is a Python library used for working with data sets.
is Pandas?
It has functions for analyzing, cleaning, exploring, and
manipulating data.
Why Use Pandas?
One of the most popular library data scientists use.
Pandas allows us to analyze big data and make
conclusions based on statistical theories.
Pandas can clean messy data sets, and make them
readable and relevant.
Relevant data is very important in data science.
Pandas Installation
Pip install pandas
Getting Started
After the pandas has been installed into the system, you need to
import the library. This module is generally imported as –
import pandas as pd
Here, pd is referred to as an alias to the Pandas. However, it is not
necessary to import the library using alias, it just helps in writing
less amount of code everytime a method or property is called.
Pandas Data Structure
Pandas generally provide two data structure for manipulating data,
They are:
1. Series
2. DataFrame
Pandas Series
A Pandas Series is like a column in a table.
It is a one-dimensional array holding data of any type.
DataFrame
A Data frame is a two-dimensional data structure, i.e., data is
aligned in a tabular fashion in rows and columns. Pandas
DataFrame consists of three principal components, the data, rows,
and columns.
Series Data Structure
Creating a Series
In the real world, a Pandas Series will be created by loading the
datasets from existing storage, storage can be SQL Database, CSV
file, and Excel file. Pandas Series can be created from the lists,
dictionary, and from a scalar value etc.
The basic method to create a Series is to call:
import pandas as <identifier name>
Import pandas as pd
<series name>=<identifier name> .Series(data, index=index)
Data can be many different things:
a Python dict
a Python list
a Python tuple
The passed index is a list of axis labels.