Q. Predict the output of the following code:
import pandas as pd
d1 = {'rollno': [101, 101, 103, 102, 104], "name": ["Pat", "Sid", "Tom", "Kim", "Ray"],\ 'physics': [90, 40, 50, 90, 65], "chem": [75, 80, 60, 85, 60]}
df = pd.DataFrame (dl)
print (df)
print (' ------ Basic aggregate functions min (), max(), sun() and mean ()')
print('minimun is:', df["physics"].min())
print('maximum is:', df["physics"].max())
print('sum is:', df ['physics'].sum())
print ("average is:', df ["physics'].mean())
Answer :-
rollno name physics chem
0 101 Pat 90 75
1 101 Sid 40 80
2 103 Tom 50 60
3 102 Kim 90 85
4 104 Ray 65 60
Basic aggregate functions min () , max() , sum () and mean()
minimum is: 40
maximum is: 90
sum is: 335
average is: 67.0
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )