Question 7: CSV|Chart

You are a gym manager tracking weekly attendance for five fitness classes: Yoga, Zumba, Pilates, Spin, and CrossFit. Input the weekly attendance for each class, display the data in a table, and generate a bar chart to visualize the most attended classes.

  1. Set up the Streamlit app:

    • Import streamlit, pandas, and plotly.express.
    • Set the app title as “Weekly Fitness Class Attendance.”
  2. Collect attendance data:

    • Use st.number_input to input attendance for Yoga, Zumba, Pilates, Spin, and CrossFit.
  3. Display data:

    • Store the class names and attendance in a pandas DataFrame.
    • Use st.table to display the data.
  4. Create a bar chart:

    • Use Plotly Express to plot attendance for each class.
    • Show the chart using st.plotly_chart.
  5. Run the app:

    • Test it locally with streamlit run app.py.
Write what you are looking for, and press enter to begin your search!