Upload folder using huggingface_hub
Browse files- .amlignore +6 -0
- app.py +67 -0
- pizza_sales.csv +0 -0
- 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,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Calculate key metrics
|
20 |
+
total_orders = df['order_id'].nunique() #Write the appropriate function which can calculate the number of unique values
|
21 |
+
total_revenue = df['total_price'].sum() #Write a appropriate function which can sum the column
|
22 |
+
most_popular_size = df['pizza_size'].value_counts().idxmax #Write a appropriate function which can get the maximum value
|
23 |
+
most_frequent_category = df['pizza_category'].value_counts().idxmax() #Write a appropriate function which can count of value of each product
|
24 |
+
total_pizzas_sold = df['quantity'].sum()
|
25 |
+
|
26 |
+
# Sidebar with key metrics
|
27 |
+
st.sidebar.header("Key Metrics")
|
28 |
+
st.sidebar.metric("Total Orders", total_orders)
|
29 |
+
st.sidebar.metric("Total Revenue", f"${total_revenue:,.2f}")
|
30 |
+
st.sidebar.metric("Most Popular Size", most_popular_size)
|
31 |
+
st.sidebar.metric("Most Popular Category", most_frequent_category)
|
32 |
+
st.sidebar.metric("Total Pizzas Sold", total_pizzas_sold)
|
33 |
+
|
34 |
+
plots = [
|
35 |
+
{"title": "Top Selling Pizzas (by Quantity)", "x": "pizza_category", "y": "quantity", "top": 5}, #Write the appropriiate column as per the title given
|
36 |
+
{"title": "Quantity of Pizzas Sold by Category and Time of the Day", "x": "time_of_day", "hue": "pizza_category"}, #Write the appropriiate column as per the title given
|
37 |
+
{"title": "Quantity of Pizzas Sold by Size and Time of the Day", "x": "time_of_day", "hue": "pizza_size"}, #Write the appropriiate column as per the title given
|
38 |
+
{"title": "Monthly Revenue Trends by Pizza Category", "x": "order_month", "y": "total_price", "hue": "pizza_category", "estimator": "sum", "marker": "o"}, #Write the appropriiate column as per the title given
|
39 |
+
]
|
40 |
+
|
41 |
+
for plot in plots:
|
42 |
+
st.header(plot["title"])
|
43 |
+
|
44 |
+
fig, ax = plt.subplots()
|
45 |
+
|
46 |
+
if "Top Selling Pizzas" in plot["title"]:
|
47 |
+
data_aux = df.groupby(plot["x"])[plot["y"]].sum().reset_index().sort_values(by=plot["y"], ascending=False).head(plot["top"])
|
48 |
+
ax.bar(data_aux[plot["x"]].values.tolist(), data_aux[plot["y"]].values.tolist())
|
49 |
+
|
50 |
+
if "Quantity of Pizzas" in plot["title"]:
|
51 |
+
sns.countplot(data=df, x=plot["x"], hue=plot["hue"], ax=ax)
|
52 |
+
|
53 |
+
if "Monthly Revenue" in plot["title"]:
|
54 |
+
sns.lineplot(data=df, x=plot["x"], y=plot["y"], hue=plot["hue"], estimator=plot["estimator"], errorbar=None, marker=plot["marker"], ax=ax)
|
55 |
+
|
56 |
+
ax.set_xlabel(" ".join(plot["x"].split("_")).capitalize())
|
57 |
+
if "y" in plot.keys():
|
58 |
+
ax.set_ylabel(" ".join(plot["y"].split("_")).capitalize())
|
59 |
+
else:
|
60 |
+
ax.set_ylabel("Quantity")
|
61 |
+
ax.legend(bbox_to_anchor=(1,1))
|
62 |
+
|
63 |
+
st.pyplot(fig)
|
64 |
+
|
65 |
+
|
66 |
+
if __name__ == "__main__":
|
67 |
+
app()
|
pizza_sales.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
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
|