111

111

import pandas as pd

student_data = pd.DataFrame({

'Id': ['S1', 'S2', 'S3', 'S4', 'S5', 'S6'],

'School': ['S001','S002','S003','S001','S002','S004'],

'Class': ['V', 'V', 'VI', 'VI', 'V', 'VI'],

'Name': ['Alberto Franco', 'Gino MCneil', 'Ryan Parkes', 'Eesha Hinton', 'Gino MCneil', 'David Parkes'],

'Date_Of_Birth': ['15/05/2002','17/05/2002','16/02/1999','25/09/1998', '11/05/2002', '15/09/1997'],

'Age': [12, 12, 13, 13, 14, 12],

'Height': [173, 192, 186, 167, 151, 159],

'Weight': [35, 32, 33, 30, 31, 32],

'Address': ['street1', 'street2', 'street3', 'street1', 'street2', 'street4']

})

student_data['Date_Of_Birth'] = pd.to_datetime(student_data['Date_Of_Birth'])

school_stats = student_data.groupby('School')['Age'].agg(['mean', 'min', 'max'])

print(school_stats)

Report Page