Average daily riders per route, drawn from a table of means
Write code · Medium · §9.2 Scatter plots, tooltips, and averages
The table rides holds the weekday rider counts of three bus routes. Each row is one day on one route. Draw one bar per route for the average number of riders per day.
Give each route its own color (color=), write the values at the ends of the bars, and use the y-axis title Average riders. Show the figure with fig.show(). Grading changes the rider counts and the number of days recorded for each route and draws the chart again.
Starter code
import pandas as pd
import plotly.express as px
rides = pd.DataFrame({
"route": ["Campus"] * 5 + ["Harbor"] * 5 + ["Market"] * 5,
"day": ["Mon", "Tue", "Wed", "Thu", "Fri"] * 3,
"riders": [410, 380, 450, 400, 520, 220, 260, 240, 250, 280, 150, 170, 140, 160, 130],
})
# Write your code hereSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.