How to analyse data using pandas module in python?

Description

To analyse the data using python pandas module.

Pandas

   Pandas is an open-source Python
Library used for high-performance data

manipulation and data analysis using its
powerful data structures.

   High performance merging and
joining of data

   Its having tools for loading data into
in-memory data objects from different file formats.

Pandas – Series

   Series is a one-dimensional array
like structure with homogeneous data.

   Size of pandas series is immutable

   Values of pandas series data is mutable.

Pandas – Data frame

   Data Frame is a two-dimensional array
with heterogeneous data.

   The size and data is mutable.

   Using this data frame we can store
our data in a table manner.

#import pandas module

import pandas as pd

print(“*********Pandas series*******”)

#pandas series for sample data

data = pd.Series([‘sathish’,’bala’,’naren’,’vivek’,

‘mano’,’suresh’,’krishna’, ‘baai’,’mubarak’,’ussain’],

index = [25,26,25,23,30,29,23,23,25,25])

print(“\n”)

print(data)

print(“\n”)

#sample data

data=

{‘name':[‘sathish’,’bala’,’naren’,’vivek’,’mano’,

‘suresh’,’krishna’,’baai’,’mubarak’,’ussain’],

‘salary':[100,200,300,400,500,400,300,200,

100,50],’age':[25,26,25,23,30,29,23,23,

25,25],’rating':[4,3.24,2.5,2.25,2,2.25,2.5,

2.75,3.2,4.2],’bonus':[2500,1200,900,

3000,1800,1400,850,250,750,1000]}

#creating data frame

df=pd.DataFrame(data)

print(“********Data Frame example*****\n”)

print(df)

Leave Comment

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

clear formSubmit