Thursday, 11 March 2021

Class 12 IP Practical - 10

 

#10. Create a data frame using dictionary.

import pandas as pd

d1={'Hindi':{'Ram':30,'Raj':20,'Sam':25,'John':35}, \

     'English':{'Ram':35,'Raj':25,'Sam':22,'John':32}, \

     'IP':{'Ram':40,'Raj':45,'Sam':45,'John':48}, \

     'Bio':{'Ram':30,'Raj':24,'Sam':25,'John':25}}

 

df=pd.DataFrame(d1)

print(df)




 

========= RESTART: C:/Program Files (x86)/Python38-32/ip-7.py =========

      Hindi  English  IP  Bio

Ram      30       35  40   30

Raj      20       25  45   24

Sam      25       22  45   25

John     35       32  48   25

>>> 

 


No comments:

Post a Comment