I'm trying to make it so the table just represents that grade achieved once on average (index 2 in the nested list), right now, if I add more entries to the list (say, 100), it turns it into a 2D bar chart with every grade achieved. How can I make it to for example if a number of students achieved grade '1', that they will be grouped into that grade, and so forth?
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
master_list = [['Q34345678', "Charles Lob Miester Taylor To", 4, 'OM555'], ['Q54345678', "Tob", 9, 'COM363'],
['Q01245678', "Pob", 10, 'COM712'], ['Q98745678', "Cob", 3, 'COM343'], ['Q64345678', "Fob", 2, 'COM098'],
['Q84245678', "Bob", 1, 'COM712'],['Q34345678', " Taylor", 4, 'OM555'],['Q54345678', "Lauren", 9, 'COM363'],
['Q01245678', "Amy", 10, 'COM712'], ['Q98745678', "Nicola", 3, 'COM343'], ['Q64345678', "Yasmin", 2, 'COM098'],
['Q84245678', "Liv", 1, 'COM712'],]
#names = list(f[1] for f in master_list)
grades = list(f[2] for f in master_list)
y_pos = np.arange(len(master_list))
plt.figure(figsize=(20,10))
plt.bar(y_pos, grades, align='center', alpha=0.6)
#plt.xticks(y_pos,grades)
plt.ylabel('Grade')
plt.xlabel('Percent of students with achieved grade')
plt.title('2021 STUDENT CLASS')
plt.show()