Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to visualize data using line graph in python?

Description

To visualize the data using line graph in python.

Process

   First import needed library functions.

   Load the data sample in to data Frame.

   Using plot() from matplot library, we can draw line graph for corresponding variables.

Sample Code

#import library

import matplotlib.pyplot as plt

import pandas as pd

#10 sample data

data={‘name’:[‘sathish’,’raj’,’raja’,’krishna’,

‘yusuf’,’praveen’,’sangee’,’ezhil’,’dinesh’

,’ganesh’], ‘salary’:[100,200,300,400,

500,400,300,200,100,50],’age’:[22,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)

plt.plot(df[‘salary’],df[‘age’],color=’g’)

plt.show()

Screenshots
visualize data using line graph in python