Thursday 11 March 2021

Class 12 IP Practical - 15

 15. WAP to represent size and shape of the  DataFrame.


import pandas as pd

d={'Ritesh':{'English':85,'Bio':82,'Physics':35,'IP':95,'Chemistry':81}, \

   'Rishabh':{'English':55,'Bio':62,'Physics':55,'IP':85,'Chemistry':91}, \

   'Harshit':{'English':65,'Bio':72,'Physics':75,'IP':91,'Chemistry':71}, \

   'Krishan':{'English':25,'Bio':75,'Physics':45,'IP':93,'Chemistry':61}, \

   'Shailesh':{'English':75,'Bio':82,'Physics':65,'IP':97,'Chemistry':51}}

df1=pd.DataFrame(d)

print("DataFrame is:")

print(df1)

print("Size of DataFrame:")

print(df1.size)

print("Shape of DataFrame:")

print(df1.shape)



>>>

========= RESTART: C:/Program Files (x86)/Python38-32/Ip-15.py ========

DataFrame is:

           Ritesh  Rishabh  Harshit  Krishan  Shailesh

English        85       55       65       25        75

Bio            82       62       72       75        82

Physics        35       55       75       45        65

IP             95       85       91       93        97

Chemistry      81       91       71       61        51

Size of DataFrame:

25

Shape of DataFrame:

(5, 5)

>>> 








No comments:

Post a Comment