Question 9: CSV|Chart

You are a school administrator tracking weekly attendance for five classes: Math, Science, English, History, and PE. Input the weekly attendance for each class, display the data in a table, and generate a bar chart to identify the most attended class.

  1. Set up the Streamlit app:

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

    • Use st.number_input to enter attendance for Math, Science, English, History, and PE.
  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 visualize the attendance data.
    • Show the chart using st.plotly_chart.
  5. Run the app:

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