Question 8: CSV|Chart

You manage a bookstore and want to analyze weekly sales for five categories: Fiction, Non-fiction, Comics, Magazines, and Textbooks. Input the weekly sales for each category, display the data in a table, and create a bar chart to show which category sold the most.

  1. Set up the Streamlit app:

    • Import streamlit, pandas, and plotly.express.
    • Set the app title as “Bookstore Weekly Sales Analysis.”
  2. Input sales data:

    • Use st.number_input to enter sales for Fiction, Non-fiction, Comics, Magazines, and Textbooks.
  3. Display data:

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

    • Use Plotly Express to visualize the sales 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!