Ip Programs
Ip Programs
import pandas as pd
'''
1 AIM: Consider the given DataFrame:
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
Write suitable Python statements for the following:
i. Add a column called ACC_NO with the following data:
[135,153,225,442].
ii. Add a new Record
iii. Remove the column qty.
'''
import pandas as pd
s1=pd.Series(['P01','P02','P03','P03'])
s2=pd.Series(["Note Book","Pencil Box","Water bottle","School bag"])
s3=pd.Series([85,76,129,730])
s4=pd.Series([500,200,50,70])
d={'Pcd':s1,'title':s2, 'Price':s3, 'qty':s4}
lib=pd.DataFrame(d)
print(lib)
lib["ACC_NO "]=[135,153,225,442]
lib.loc[4]=["p05","bigbook",20,20,501]
print(lib)
lib.drop(["qty"],axis=1,inplace=True)
print(lib)
'''
2 Consider the following data :
Year 2011 2012 2013 2014 2015
Rain(mm)120 130 110 190 140
'''
AIM: Write a program to create a horizontal bar chart for India's medal tally.
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
'''