KnowledgeBoat Logo
|

Informatics Practices

Given a data frame df1 as shown below :

 199020002010
a52340890
b64480560
c786881102
d94766889

Write code to create a line chart from the 1990 and 2000 columns of dataframe df1.

PyPlot

2 Likes

Answer

import pandas as pd
import matplotlib.pyplot as plt
data = {'1990': [52, 64, 78, 94],
        '2000': [340, 480, 688, 766],
        '2010': [890, 560, 1102, 889]}
df1 = pd.DataFrame(data, index=['a', 'b', 'c', 'd'])
plt.plot(df1['1990'], df1['2000'])
plt.show()
Output
Given a data frame df1 as shown below : Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Answered By

1 Like


Related Questions