Import
Import
Import
pyplot as plt
Subject = ['Physics','Chemistry','Maths','English','IP']
percentage =[89,90,97,90,99]
plt.bar(Subject, percentage,align
="center",color='purple')
plt. xlabel('SUBJECT NAME')
plt. ylabel ('PASS PERCENTAGE')
plt.title('RESULT ANALYSIS')
plt.show ()
import pandas as pd
import numpy as np
print (' 1. **creation of empty dataframe**' )
print (' 2. **creation of dataframe using series**')
print ('3. **creation of dataframe using list of dict**')
print ('4. **creation of dataframe using dict of list**')
print ('5. **creation of dataframe using dict of
series**')
print ('6. **creation of dataframe using list**')
print ('7. **exit**')
while True :
ch = int (input("ENTER YOUR CHOICE : "))
## Creation of empty dataframe
if ch==1:
d1 = pd.DataFrame ()
print (d1)
##creation of database using series
elif ch ==2 :
Ser1 = pd.Series ([9,12,15,18])
DF1 = pd.DataFrame (Ser1)
print (DF1)
##Creation of database using list of dictionaries
elif ch ==3:
D={'a':30 ,'b':50,'c':70}
D1 ={'a':30 ,'b':50,'c':70}
DF2 = pd.DataFrame ([D,D1])
print(DF2)
##Creation of dict of list
elif ch ==4 :
STUDENT ={'NAME' :
['REN','CHAR','ALEX','HAZEL'],'ACCOUNTANCY' :
[90,95,90,92]}
DF3 = pd.DataFrame (STUDENT)
print(DF3)
##Creation of dataframe using dict of series
elif ch ==5 :
S =pd.Series (['REN','CHAR','ALEX','HAZEL'])
ACC =pd.Series ([90,95,90,92])
student_result ={"NAME":
S,"ACCOUNTANCY" :ACC}
DF4 = pd.DataFrame(student_result)
print (DF4)
##Creation of dataframe using list
elif ch==6 :
L1=[15,30,45,60]
DF5=pd.DataFrame (L1)
print (DF5)
##Exit
elif ch==7 :
quit ()
else : print ("##PLEASE ENTER A VALID INPUT : ##")
if input("DO YOU WANT TO CONTINUE(y/n): ")!='y' :
print ("** YOUR PROGRAM IS OVER<THANK YOU
FOR WORKING **")
break
import pandas as pd
p = pd.Series([98,86,74,65])
print(p)
result = p.quantile(0.75)
print("75th percentile of series is : " , result)
print("The elements that are above 75th
percentile :",p[p>75])
import pandas as pd
dic ={'Category':
['MEDICAL','GROCERRY','CLOTHES'],'ITEM NAME':
['ANTISEPTICS','FLOUR','SKIRTS'],'EXPENDITURE':
[100,200,500]}
quaterly_sales =pd.DataFrame(dic)
print (quaterly_sales)
C=quaterly_sales.groupby ('Category')
print('Result after filtering')
print(C.sum())
import pandas as pd
sales ={'item':[90,54,38,70],'qty':[4,7,2,6],'price':
[5000,3050,6850,1250]}
df1=pd.DataFrame(sales)
print(df1 ['price'].describe().round(4))
import pandas as pd
dic ={'Class' : ['VI','VII','VII','IX','X','XI','XII'],'PASS' :
[190,185,180,175,190,160,195]}
RESULT =pd.DataFrame (dic)
print(RESULT)
print(RESULT.dtypes)
print(RESULT.shape)
import pandas as pd
dic ={'NAME':
['LIA','LIA','EDWARD','MAGNUS'],'MarksIP' :
[80,80,90,98]}
MARKS = pd.DataFrame (dic)
duplicate = MARKS[MARKS.duplicated(keep=False)]
print (duplicate)
import pandas as pd
profit ={'TCS':{'QTR':10000, 'QTR1':10050 },'WIP' :
{'QTR': 9000,'QTR1' : 9050}}
df =pd.DataFrame (profit)
print(df)
print ('Column wise sum in df is:', df.sum (axis=0))
print('column wise with minimum mean
is:',df.mean(axis =0))
import pandas as pd
dic ={'NAME':
['LIA','LIA','EDWARD','MAGNUS'],'MarksIP' :
[80,80,90,98]}
MARKS = pd.DataFrame(dic)
print (MARKS.nlargest(3,['MarksIP']))
import pandas as pd
PROFIT ={'a':[2.5,3.5],'b':[1.25,3.75],'c':[2.25,1.75]}
df =pd.DataFrame(PROFIT)
print(df)
print(df.mean(axis =1))
print(df.sub(df.mean(axis=1),axis =0))
import pandas as pd
dic ={'DATA':[-6,9,6,4,-2],'DATA2':[5,7,-1,-8,-3]}
df =pd.DataFrame (dic)
print(df)
print('df after replacing negative value with 0:')
print (df [df<0]+0)
import pandas as pd
empdata = {'empid':[491,492,493,494],'ename':
['NOAH','BELLA','ARTHUR','HANNAH']}
df =pd.DataFrame(empdata)
print(df)
df=df.fillna({'ename':999})
print(df)