CLASS 12th IP Practical-1

Class 12th IP

SOLUTION

import pandas as pd
a = {'Maths':[100,95,85],
     'SCIENCE':[90,50,90],
     'ENGLISH':[85,90,65]
     }
df = pd.DataFrame(a,index=['Mohit','Nishant','Sudha'])
print(df)
print("-----------------------1----------------------")
print()
df['total']=df['Maths'] + df['SCIENCE'] + df['ENGLISH']
print(df)
print("-------------------2--------------------")
print()
df.loc['Harish']=[77,85,69,77+85+69]
print(df)
print("------------------------3---------------------")
print()
print(df[['Maths','SCIENCE']])
print("------------------4-------------------")
print()
df.loc['Sudha','SCIENCE']=85
print(df)
print("----------------------5-----------------")
print()
df = df.drop(index='Mohit')
print(df)

Output

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.