I would have done something like:
Last column = status
import numpy as np myClass = [["Lang", "Carla", 49, 71, 95, 50], ["Bucklund", "Pia", 86, 78, 83, 64], ["Lang", "Jason", 95, 57, 92, 62], ["Dimitrousis", "Hector", 93, 45, 89, 96], ["Owens", "Sunna", 45, 50, 46, 54], ["Goldin", "Sandra", 25, 60, 45, 55], ["Giles", "Seth", 67, 73, 93, 64], ["Gurillo", "Melanie", 88, 88, 62, 79], ["Rykiel", "Kari", 67, 92, 54, 86], ["Shailes", "Dennis", 56, 70, 84, 62]] myClass = np.asarray(myClass) # get numbers only + mean calculations Notes = myClass[:, 2:].astype(float) Mean = np.mean(Notes, axis = 1).reshape(-1, 1) # check status (pass by default) Status = np.empty( (10,1), dtype='object') Status[:] = 'Pass' # now we can look for 'failed' status t = np.where(Mean < 50) Status[t] = 'Fail' # Concat results myClass = np.hstack((myClass, Mean, Status)) print(f"{myClass}")Providing:
Output:[['Lang' 'Carla' '49' '71' '95' '50' 66.25 'Pass']
['Bucklund' 'Pia' '86' '78' '83' '64' 77.75 'Pass']
['Lang' 'Jason' '95' '57' '92' '62' 76.5 'Pass']
['Dimitrousis' 'Hector' '93' '45' '89' '96' 80.75 'Pass']
['Owens' 'Sunna' '45' '50' '46' '54' 48.75 'Fail']
['Goldin' 'Sandra' '25' '60' '45' '55' 46.25 'Fail']
['Giles' 'Seth' '67' '73' '93' '64' 74.25 'Pass']
['Gurillo' 'Melanie' '88' '88' '62' '79' 79.25 'Pass']
['Rykiel' 'Kari' '67' '92' '54' '86' 74.75 'Pass']
['Shailes' 'Dennis' '56' '70' '84' '62' 68.0 'Pass']]
penultimate column = meanLast column = status