Question: Using Python. Transform the letter grades to simplified 4.0 scale. In the simplified scale, there are only 5 available grades, which are `A`, `B`, `C`,
Using Python. Transform the letter grades to simplified 4.0 scale. In the simplified scale, there are only 5 available grades, which are `A`, `B`, `C`, `D`, and `F`. Thus, remove the `+` and `-` suffixes from the letter grades before mapping. If the input grade is not valid (e.g., `S`, return np.nan).
When transforming letter grades to 4.0 scale, use the following mapping:
- A => 4.0
- B => 3.0
- C => 2.0
- D => 1.0
- F => 0.0
Resulting data frame should include both letter grades and simplified 4.0 scale grades.
_____________________________________________________________________
The solution starts with:
import pandas as pd
grades_df = pd.DataFrame(data = {'John': ['A+'], 'Linus':['B'], 'Alan':['C-'], 'Ada':['D'], 'Grace':['B+'], 'Donald':['F']}, index=['Letter_Grades']).T
...
# The input
# grades_df['4.0scale'] should return
# John 4.0
# Linus 3.0
# Alan 2.0
# Ada 1.0
# Grace 3.0
# Donald 0.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
