Monthly members of two clubs

Write code · Basic · §9.1 From static figures to exploration

The table clubs holds the members of the photo club Photo and the band club Band from January to April. With Plotly Express, draw a line chart with the month (month) on the x-axis and the members (members) on the y-axis, one line per club.

Mark the points too, and use the title Club members. Show the figure with fig.show(). Grading changes the member counts and draws the chart again.

Target figure for Monthly members of two clubs
Target figure

Starter code

import pandas as pd
import plotly.express as px

clubs = pd.DataFrame({
    "month": [1, 2, 3, 4, 1, 2, 3, 4],
    "club": ["Photo", "Photo", "Photo", "Photo", "Band", "Band", "Band", "Band"],
    "members": [12, 15, 18, 17, 20, 19, 22, 25],
})

# Write your code here

Solve 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.