Write a Pandas program to calculate the total of the examination attempts and the mean score in data frame. Display the first four rows in the output. import pandas as pd import numpy as np exam_data...


Write a Pandas program to calculate the total of the examination attempts and the mean score in data frame. Display the first four rows in the output.


import pandas as pd
import numpy as np
exam_data  = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'],
        'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19],
        'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
        'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']}
labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


df = #TO DO -- Complete the Code
# print(df)
print("\nSum of the examination attempts by the students:")
print() #TO DO -- Complete the Code
print("\nMean score for each different student in data frame:")
print() #TO DO -- Complete the Code
print() #TO DO -- Complete the Code


Expected output


Sum of the examination attempts by the students:
19


Mean score for each different student in data frame:
13.5625
        name    score   attempts   qualify
a  Anastasia   12.5         1          yes
b       Dima      9.0          3          no
c  Katherine   16.5          2        yes
d      James    NaN         3          no



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here