What is Python Pandas
Pandas is a module or package created for the Python programming language for data manipulation and analysis.
In particular, it offers data structures and operations for manipulating numerical tables and time series.
Python Pandas can be used to connect to any type of structured datasets like Excel, CSV, JSON, HTML, SQL etc.
“Pandas” can be assumed as “Panel Data”, or “Python Data Analysis” , it was created by Wes McKinney in 2008.
Pandas can be use to plot graphs as well. We can use the Matplotlib library or we can use the Seaborn package for plotting graphs.
- 1D Collection of values is called Series in Pandas.
- 2D Collection of values (a tabular data) is called as DataFrame in Pandas.
How to Install Python Pandas
There are different ways of installing Python pandas in your computer.
- Use Jupyter Notebook from Anaconda Navigator. Pandas package comes preinstalled in Jupyter.
- You can run “pip install pandas” command in your command prompt.
- You can use Google Colab IDE. If your computer is low end, you can use Google Colab to create Notebooks. Python and other useful Data Analytics packages are preinstalled in Google Colab. Your work is saved in Google Drive.
How to Import Python Pandas in Your Notebook or IDE
You have to type
import pandas as pd
df = pd.read_csv("data.csv") # Here data.csv is the dataset that we want
to explore. # Here df is a DataFrame Object. A 2D table like value
which has Rows , Columns and # Index. We will discuss more on this
later
Another Example
import pandas as pd
data = {
'student': ["Mohan", "Mark", "Elina"],
'marks': [80, 90, 70]
}
df = pd.DataFrame(data)
print(df)
Output of This Code will be
student marks 0 Mohan 80 1 Mark 90 2 Elina 70 This is an example of Pandas Dataframe (2D) Object If we select only 1 Column marks 0 80 1 90 2 70
This is an example of Pandas Series Object.
In the example given above we have connected our Notebook with a CSV file. Similarly we can connect with other type of Datasets as well. You will learn all that in the upcoming articles of this tutorial series.
In this tutorial series we will share
- How to Explore Datasets in Pandas.
- Different Methods and Attributes in Pandas