KnowledgeBoat Logo
|

Informatics Practices

Given a data frame df1 as shown below :

 199020002010
a52340890
b64480560
c786881102
d94766889

Write code to create a bar chart plotting the three columns of dataframe df1.

PyPlot

2 Likes

Answer

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'])
df1.plot(kind = 'bar')
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

3 Likes


Related Questions