Saif-bio commited on
Commit
0a478de
·
verified ·
1 Parent(s): 39686e2

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .amlignore +6 -0
  2. app.py +82 -0
  3. requirements.txt +5 -0
.amlignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ ## This file was auto generated by the Azure Machine Learning Studio. Please do not remove.
2
+ ## Read more about the .amlignore file here: https://docs.microsoft.com/azure/machine-learning/how-to-save-write-experiment-files#storage-limits-of-experiment-snapshots
3
+
4
+ .ipynb_aml_checkpoints/
5
+ *.amltmp
6
+ *.amltemp
app.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import seaborn as sns
3
+ import matplotlib.pyplot as plt
4
+ import pandas as pd
5
+
6
+ # Load data
7
+ def load_data():
8
+ df = pd.read_csv("processed_data.csv") # Replace with your dataset
9
+ return df
10
+
11
+ # Create Streamlit app
12
+ def app():
13
+ # Title for the app
14
+ st.title("Pizza Sales Data Analysis Dashboard")
15
+ df = load_data()
16
+
17
+ df = pd.DataFrame(df)
18
+
19
+ """"""""""""
20
+ # Calculate key metrics
21
+ # Write a code snippet to calculate key metrics from the pizza orders dataframe, including the
22
+ # total number of unique orders, total revenue generated, the most popular pizza size, the most
23
+ # frequent pizza category, total pizzas sold
24
+ total_orders = df['order_id'].drop_duplicates() #function which can calculate the number of unique values
25
+ total_revenue = df['total_price'].sum() #function which can sum the column
26
+ most_popular_size = df['pizza_size'].value_counts().idxmax() #function which can get the maximum value
27
+ most_frequent_category = df['pizza_category'].value_counts().idxmax() #function which can count of value of each product
28
+ total_pizzas_sold = df['quantity'].sum()
29
+
30
+
31
+ """"""""""""
32
+
33
+ # Sidebar with key metrics
34
+ # Write a code snippet to display key metrics in the sidebar of a Streamlit application.
35
+ # Show the total number of orders, total revenue (formatted as currency), the most popular
36
+ # pizza size, the most popular pizza category, and the total number of pizzas sold
37
+ # using the st.sidebar.metric function.
38
+ st.sidebar.header("Key Metrics")
39
+ st.sidebar.metric("Total Orders", total_orders)
40
+ st.sidebar.metric("Total Revenue", f"${total_revenue:,.2f}")
41
+ st.sidebar.metric("Most Popular Size", most_popular_size)
42
+ st.sidebar.metric("Most Popular Category", most_frequent_category)
43
+ st.sidebar.metric("Total Pizzas Sold", total_pizzas_sold)
44
+
45
+
46
+
47
+ """""""""""""
48
+
49
+ # Provide the details of the plots here
50
+
51
+ plots = [
52
+ {"title": "Top Selling Pizzas (by Quantity)", "x": "pizza_name", "y": "quantity", "top": 5}, #Write the appropriiate column as per the title given
53
+ {"title": "Quantity of Pizzas Sold by Category and Time of the Day", "x": "order_time", "hue": "pizza_category"}, #Write the appropriiate column as per the title given
54
+ {"title": "Quantity of Pizzas Sold by Size and Time of the Day", "x": "order_time", "hue": "pizza_size"}, #Write the appropriiate column as per the title given
55
+ {"title": "Monthly Revenue Trends by Pizza Category", "x": "order_date", "y": "total_price", "hue": "pizza_category", "estimator": "sum", "marker": "o"}, #Write the appropriiate column as per the title given
56
+ ]
57
+
58
+ for plot in plots:
59
+ st.header(plot["title"])
60
+
61
+ fig, ax = plt.subplots()
62
+
63
+ if "Top Selling" in plot["title"]:
64
+ sns.countplot(data=df, x=plot["x"], y=plot["y"],top=plot["top"])
65
+ if "Category" in plot["title"]:
66
+ sns.countplot(data=df, x=plot["x"], hue=plot["hue"])
67
+ if "Size" in plot["title"]:
68
+ sns.countplot(data=df, x=plot["x"], hue=plot["hue"])
69
+ if "Revenue" in plot["title"]:
70
+ sns.countplot(data=df, x=plot["x"], y=plot["y"],ax=plot["top"], hue=plot["hue"], estimator=plot["estimator"], marker=plot["marker"])
71
+
72
+ else:
73
+ ax.set_ylabel("quantity")
74
+ ax.legend(bbox_to_anchor=(1,1))
75
+
76
+
77
+ st.pyplot(fig)
78
+ plt.show()
79
+
80
+
81
+ if __name__ == "__main__":
82
+ app()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ pandas==1.5.2
2
+ matplotlib==3.6.2
3
+ seaborn==0.12.1
4
+ scipy==1.10.0
5
+ numpy==1.23.5