0% found this document useful (0 votes)
92 views2 pages

IE 555 - Programming For Analytics: Due Date: To Be Determined

This document describes Homework #5 which involves writing a Python function to analyze student grade data from a .csv file. The function takes in a filename, number of exams, and homework weight. It returns 5 pieces of information about the grades: (1) the average of HW1, (2) sorted grades of HW2, (3) students with 90+ on HW1 and HW3, (4) students with 80 or below on HW1 and 90+ on HW2, and (5) each student's weighted average grade rounded to 1 decimal place. The function uses NumPy to work with and return the data.

Uploaded by

ketulpatl
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)
92 views2 pages

IE 555 - Programming For Analytics: Due Date: To Be Determined

This document describes Homework #5 which involves writing a Python function to analyze student grade data from a .csv file. The function takes in a filename, number of exams, and homework weight. It returns 5 pieces of information about the grades: (1) the average of HW1, (2) sorted grades of HW2, (3) students with 90+ on HW1 and HW3, (4) students with 80 or below on HW1 and 90+ on HW2, and (5) each student's weighted average grade rounded to 1 decimal place. The function uses NumPy to work with and return the data.

Uploaded by

ketulpatl
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
You are on page 1/ 2

IE 555 – Programming for Analytics

Homework #5 – Working with NumPy

Due Date: To Be Determined

Sometimes source data aren’t in a format that we would’ve designed. The purpose of this assignment
is to help you practice using numpy and to work with poorly formatted data.

Assignment Details

You need to write a function that calculates some statistics about student grades in a particular
course.

• Your function should be in a Python script named UCASEUBUSERNAME grades.py; replace


UCASEUBUSERNAME with your UB user name in all caps.
• Within this python script, you should write a function named gradeInfo.
• The gradeInfo() function will be called as follows:
gradeInfo(filename, numExams, hwWeight)
– See UCASEUBUSERNAME grades.py for information about these three input parameters.

Your gradeInfo() function should do the following:

1. Import the given .csv file. See grades example.csv, which describes the structure of input
files.
2. Return the following five (5) pieces of information, in this order:

(a) Find the average of HW1.


Return this as a scalar value in the range [0, 100].
(b) Sort the grades in descending order for HW2 (best grades first).
Return as a (n x 2) numpy array. There are n rows, where each row is a student. The
first column returned should be the student ID, the second column is the score on HW2
(as a score in the range [0, 100]).
(c) Find the students who made 90 or above on both HWs 1 and 3.
Return as a 1-dimensional numpy array, just containing ID numbers.
(d) Find the number of students who made 80 or below on HW1 and 90 or above on HW2.
Return as a scalar integer.
(e) Each homework is equally weighted. Find each student’s current average grade, rounded
to 1 decimal place, in the range [0, 100].
Return as a (n x 2) numpy array. There are n rows in the source data, where each row is
a unique student. The first column to be returned is the student ID, the second column
is the weighted score in the range [0, 100].

1
• For example, suppose a student had the following scores:
Homework: 9/10, 4/5, 35/50. Exam1: 85/100

If hwWeight = 0.4, the student’s average grade is ( ( (9/10 + 4/5 + 35/50)/3 ) *


0.4 + ( (85/100)/1 ) * (1 - 0.4) ) * 100 = 83.0

You might also like