Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

=+ Does this site have scientific, medical, or legal advice?

Answered: 1 week ago

Question

6. Vanguard

Answered: 1 week ago

Question

1. PricewaterhouseCoopers

Answered: 1 week ago