Question 6: CSV|Chart

You are the manager of a small bakery, and you want to analyze the weekly sales of your baked goods. The bakery sells five types of items: Bread, Cakes, Muffins, Cookies, and Pastries. At the end of the week, you want to input the sales figures for each item, display them in a table, and generate a bar chart to visualize which items sold the most.

  1. Set up the Streamlit app structure:

    • Import necessary libraries (streamlit, pandas, plotly.express).
    • Set a title for the app (e.g., “Bakery Weekly Sales Analysis”).
  2. Create input fields for sales data:

    • Use st.number_input for each item to collect the weekly sales figures for Bread, Cakes, Muffins, Cookies, and Pastries.
  3. Process the data:

    • Store the item names and sales figures in a pandas DataFrame.
    • Ensure that the data is displayed in a table using st.dataframe.
  4. Visualize the data:

    • Use Plotly Express to create a bar chart showing sales for each item.
    • Display the bar chart in Streamlit 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!