#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • 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.

Sapmle 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