Module 5 practice question
Develop a Python program using NumPy and Pandas to create a student marks report containing
student ID, name, and marks in three subjects. Perform data analysis, apply indexing or filtering to
access specific student records, and compute total and average marks. Display the report in a
structured format.
import numpy as np
import pandas as pd
# Creating student data
data = {
'ID': [1, 2, 3, 4],
'Name': ['Anu', 'Banu', 'Kiran', 'David'],
'Maths': [85, 78, 92, 88],
'Science': [80, 74, 95, 90],
'English': [82, 79, 91, 84]
}
# Creating DataFrame
df = [Link](data)
# Calculating Total Marks
df['Total'] = df[['Maths', 'Science', 'English']].sum(axis=1)
# Calculating Average Marks
df['Average'] = df[['Maths', 'Science', 'English']].mean(axis=1)
# Accessing a specific student record
print("Student Record with Index 2:")
print([Link][2])
# Filtering students with average marks above 85
print("\nStudents with Average Marks > 85:")
print(df[df['Average'] > 85])
# Displaying complete report
print("\nStudent Marks Report:")
print(df)