Question: Python Pandas Question Using the Map Method (No Loops Allowed) Think back to the college grading policy exercise. This policy requires that the interpolated median
Python Pandas Question Using the Map Method (No Loops Allowed)
Think back to the college grading policy exercise. This policy requires that the interpolated median of final letter grades for this course fall in the range of 3:33 +- 0.2 (or about a B+). The formula for the interpolated median is:
M - 0.167 + ((0.5N - n1)/n2) * 0.333
Where: M is the standard median N is the total number of grades n1 is the number of grades less than the standard median n2 is the number of grades equal to the standard median
If n2 = 0, then IM = M.
The file grades.txt (attached below ) contains the same grades from that exercise. Rewrite your exercise to read the file into a Series or DataFrame and perform the computations using vector operations. Here is an example:
In [1]: interpolated_median('grades.txt') Out[1]: 2.625
The file grades.txt is pasted below:
A-
B C A C A B C- C+ B- B- A- B B+ C- C+ C B- A C C B- A C- C
NOTE: In the US, letter grades generally run on a 4.0 scale with A = 4.0, A- = 3.67, B+ = 3.33, B = 3.0, B- = 2.67, etc.
I will prefer if the solution can be returned within the next 3 hours max. Last time I lost marks because the solution came after the deadline, so sad.
Point of Stress: Please attach a print screen in addition to the codes to show the scripts ran properly and as intended. Thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
