0% found this document useful (0 votes)
7 views1 page

Module 5 Practice Question

The document outlines a Python program that utilizes NumPy and Pandas to create a student marks report, including student ID, name, and marks in three subjects. It calculates total and average marks, allows for indexing to access specific student records, and filters students based on average marks. The program displays the complete report in a structured format.

Uploaded by

ajubrough666
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Module 5 Practice Question

The document outlines a Python program that utilizes NumPy and Pandas to create a student marks report, including student ID, name, and marks in three subjects. It calculates total and average marks, allows for indexing to access specific student records, and filters students based on average marks. The program displays the complete report in a structured format.

Uploaded by

ajubrough666
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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)

You might also like