Question: average = 10 math['Above Average'] = ['y' if x > average else 'n' for x in math['G3']] above_avg = sum(math['Above Average'] == 'y') below_avg =

average = 10

math['Above Average'] = ['y' if x > average else 'n' for x in math['G3']]

above_avg = sum(math['Above Average'] == 'y')

below_avg = sum(math['Above Average'] == 'n')

print(f'Number of students above average: {above_avg}')

print(f'Number of students below average: {below_avg}')

math[math['Above Average'] == 'y'].hist(column='age', color='pink')

plt.title('Age of people with grade above average')

math[math['Above Average'] == 'n'].hist(column='age', color='black')

plt.title('Age of people with grade below average')

plt.show()

This Python code I wrote creates two separate histograms. I need to create an overlapping histogram using code above, placing people whose age is above and below an average grade. (from csv file)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!