Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

QNo Question Output

Predict the output.


import pandas as pd data=[[1,"abc",90],[2,"def",98],[3,"ghi",89]]
1 df1 = pd.DataFrame( data)
print(df1)

Predict the output.


import pandas as pd
2 data=[[1,"abc",90],[2,"def",98],[3,"ghi",89]]
df1 = pd.DataFrame( data,index=["I","II","III"])
print(df1)

Predict the output.


import pandas as pd
3 df=pd.DataFrame()
print(df)

Predict the output.


dict1={'Students':['Neha','Maya','Reena'],
'Marks':[20,40,30],\
4 'Sports':['Cricket', 'Football','Badminton']
}
df1=pd.DataFrame(dict1)
print(df1)

Predict the output.


smarks=pd.Series({'Neha':80,'Maya':90,'Reena':70})
sage=pd.Series({'Neha':25,'Maya':30,'Reena':29})
5 dict={'Marks':smarks,'Age':sage}
df3=pd.DataFrame(dict)
print(df3)

Predict the output.


6 student=[{'Neha':50,'Manu':40},{'Neha':60,'Maya':45}]
df4=pd.DataFrame(student,index=['term1','term2'])
print(df4)
Predict the output.
import pandas as pd
dict={'BS':[80,98,100,65,72],'ACC':[88,67,93,50,90],
7 'ECO':[100,75,89,40,96],'IP':[100,98,92,80,86]}
df5=pd.DataFrame(dict,index=['Ammu','Achu','Manu','Anu','Abu'])
print(df5)

Predict the output.


import pandas as pd
dict={'BS':[80,98,100,65,72],'ACC':[88,67,93,50,90],
8 'ECO':[100,75,89,40,96],'IP':[100,98,92,80,86]}
df5=pd.DataFrame(dict,index=['Ammu','Achu','Manu','Anu','Abu'])
print(df5>90)
Predict the output.
import pandas as pd
dict={'BS':[80,98,100,65,72],'ACC':[88,67,93,50,90],
9 'ECO':[100,75,89,40,96],'IP':[100,98,92,80,86]}
df5=pd.DataFrame(dict,index=['Ammu','Achu','Manu','Anu','Abu'])
print(df5[df5>90])

BS ACC ECO IP BS IP
Ammu 80 88 100 100 Ammu 80 100
Achu 98 67 75 98 WAP to get Achu 98 98
10 Manu 100 93 89 92 this output Manu 100 92
Anu 65 50 40 80 Anu 65 80
Abu 72 90 96 86 Abu 72 86

Write code to create, display dataframe and display DEPT in A


A B C
import pandas as pd DEPT CS PROD MEDICAL
data={"A":["CS",101,"ABC",200000],"B":["PROD",102,"PQR",100000],"C": EMPNO 101 102 103
["MEDICAL",103,"LMN",20000]} ENAME ABC PQR LMN
11 ________________________________________________________________ SALARY 200000 100000 20000
________________________________________________________________
________________________________________________________________ CS

You might also like