Data Visualization 2 ip
Data Visualization 2 ip
df1=pd.DataFrame(x)
df1.plot.bar()
plt.show()
Q. Given a data frame df1 as shown below:
>>> d={1990:[52,64,78,94],2000:[340,480,688,766],2010:[890,560,1102,889]}
>>> df1=pd.DataFrame(d)
>>> df1.plot(x = 1990, y = 2000,marker=‘D’, markersize=7);
>>>pl.show()
import pandas as pd
import matplotlib.pyplot as plt
d={1990:[52,64,78,94],2000:[340,480,688,766],2010:[890,560,1102,889]}
df1=pd.DataFrame(d)
df1.plot.bar()
plt.show()
Q. Given a data frame df as shown below:
IP CS ENG
2019 90 92 89
2020 91 81 91
2021 97 96 88
Write code to create bar chart of the above with different-2 color as (Red, Blue and Yellow).
import matplotlib.pyplot as plt
import pandas as pd
record={'IP': pd.Series([90, 91, 97], index=['2019','2020','2021']),
'CS': pd.Series([92, 81, 96], index=['2019','2020','2021']),
'ENG': pd.Series([89, 91, 88], index=['2019','2020','2021'])}
S=pd.DataFrame(record)
print(S)
S.plot.bar(color=['red','blue','yellow'],edgecolor='white',linewidth=2,linestyle='--')
plt.show()
Country Gold Silver Bronze Total
Australia 80 59 59 198
England 45 45 46 136
India 26 20 20 66
Canada 15 40 27 82
New 15 16 15 46
Zealand
South 13 11 13 37
Africa
Wales 10 12 14 36
Scotland 9 13 22 44
Nigeria 9 9 6 24
Cyprus 8 1 5 14