Introduction to Pandas
“Pandas” – It is an Open-source library in Python. Main purpose of this library is used for data analysis and data manipulation. It organizes, analyses the data and removes the unwanted data.
Panda work like an Excel spreadsheet.
Why pandas?
- It reads the data from various databases.
- It filters and sorts the records.
- It handles the missing values.
- It cleans the messy data.
- It creates the reports.
- It also performs the statistical analysis.
First, install the pandas.
Importing the Pandas:
Creating and Understanding Series in Pandas:
A Pandas Series is a
one-dimensional name for an array that can store the following data types.
- Integers
- Floats
- Strings
- Boolean
values
- Mixed
data types
Let us create a Series as a single column of a table.
This program is used to create a single dimensional array and
display the series value.
Code:
#imports the pandas
import pandas as pd
#create a series of data in integer
numbers = pd.Series([11, 22, 33, 44, 55, 66])
print(numbers)
Output:
0 11
1 22
2 33
3 44
4 55
5 66
dtype: int64
Index is the in the
Left side and Right side denotes the Values.’dtype’ represents the Data type.
Next, the code shows how to access the Elements in the
series.
Code:
#import the pandas
import pandas as pd
#create a series with 5 elements
s = pd.Series([11, 22, 33, 44, 55])
#print the first element and last element
print(s[0])
print(s[4])
Output:
11
55
These are the ways to install pandas and import it into
python. First code in pandas include the creation of Series data structure and
its basic operations. Hope, you understood the concept. Keep Coding!!!
Comments
Post a Comment