24.9k views
1 vote
Given the file name of a .tsv file read from user input containing student names and the respective course assignment grades, complete a program that performs the following tasks:

1. read the input file as a pandas dataframe.
2. output the students' names and grades in descending order of finals scores.
3. output each assignment's max score.
4. output the median and average of each assignment's scores.
5. output the standard deviation of each assignment's scores.

notes:
a. steps 3 through 5 should only require one function for each step. ex. finding the max of each assignment uses max()
b. append .to string() to the end of the function call in order to silence an extraneous line that occurs at the end of the output.
c. for steps 3, 4, and 5, the functions used will require the parameter numeric only

1 Answer

3 votes

Final answer:

Using pandas to sort a .tsv file of student grades, one can output student names and grades, find assignment maximum scores, median and average scores, and standard deviations by using built-in functions with the numeric_only parameter.

Step-by-step explanation:

Analysis of .tsv Data File Using Pandas

When working with a .tsv file containing student names and course assignment grades, it is critical to manipulate the data accurately to extract meaningful insights. Here is a step-by-step approach to complete the tasks using Pandas in Python:

Import the Pandas library and use the read_csv() function with a tab delimiter to load the .tsv file into a dataframe.

Sort the dataframe in descending order by finals scores to output the student names and grades using the sort_values() function.

To find each assignment's maximum score, apply the max() function with the parameter numeric_only=True.

Calculate the median and average (mean) scores of each assignment via the median() and mean() functions, respectively, while again using numeric_only=True.

Determine the standard deviation of each assignment's scores using the std() function with numeric_only=True.

Append .to_string() at the end of the function calls to format the output and silence any extraneous lines. These steps efficiently analyze the dataset for your specific needs, including finding the sample mean, constructing histograms, and computing various statistical measures such as quartiles and percentiles.

User Charles Khunt
by
8.6k points