Extracting Integers from an Array and Creating a List of Strings

Viewed 18

I'm basically just trying to get the number value into a letter grade but I jut can't think how to do it, really appreciate the help

#turned datadrame column of reading scores into an array
ReadingScoreArray = StudentExamsIndexed[['reading score']].to_numpy()
#my attempt at trying to iterate through the values to get A B C D F
for scores in ReadingScoreArray:
if 90 <= scores == 100:
    scores = 'A'
elif 80 <= scores <=89:
    scores = 'B'
elif 70 <= scores <= 79:
    scores = 'C'
elif 60 <= scores <= 69:
    scores = 'D'
else:
    scores = 'F'

print(scores)
0 Answers
Related