Update app.py
Browse files
app.py
CHANGED
@@ -28,9 +28,9 @@ def app():
|
|
28 |
st.sidebar.metric("Total Orders", total_orders)
|
29 |
plots = [
|
30 |
{"title": "Top Selling Pizzas (by Quantity)", "x": "pizza_name", "y": "quantity", "top": 5}, #Write the appropriiate column as per the title given
|
31 |
-
{"title": "Quantity of Pizzas Sold by Category and Time of the Day", "x": "
|
32 |
-
{"title": "Quantity of Pizzas Sold by Size and Time of the Day", "x": "
|
33 |
-
{"title": "Monthly Revenue Trends by Pizza Category", "x": "
|
34 |
]
|
35 |
|
36 |
for plot in plots:
|
@@ -44,7 +44,9 @@ def app():
|
|
44 |
ax.tick_params(axis='x', rotation=45)
|
45 |
|
46 |
if "Quantity of Pizzas" in plot["title"]:
|
47 |
-
|
|
|
|
|
48 |
|
49 |
if "Monthly Revenue" in plot["title"]:
|
50 |
sns.lineplot(data=df, x=plot["x"], y=plot["y"], hue=plot["hue"], estimator=plot["estimator"], errorbar=None, marker=plot["marker"], ax=ax)
|
|
|
28 |
st.sidebar.metric("Total Orders", total_orders)
|
29 |
plots = [
|
30 |
{"title": "Top Selling Pizzas (by Quantity)", "x": "pizza_name", "y": "quantity", "top": 5}, #Write the appropriiate column as per the title given
|
31 |
+
{"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
|
32 |
+
{"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
|
33 |
+
{"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
|
34 |
]
|
35 |
|
36 |
for plot in plots:
|
|
|
44 |
ax.tick_params(axis='x', rotation=45)
|
45 |
|
46 |
if "Quantity of 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 |
+
sns.countplot(data_aux=df, x=plot["x"], hue=plot["hue"], ax=ax)
|
49 |
+
|
50 |
|
51 |
if "Monthly Revenue" in plot["title"]:
|
52 |
sns.lineplot(data=df, x=plot["x"], y=plot["y"], hue=plot["hue"], estimator=plot["estimator"], errorbar=None, marker=plot["marker"], ax=ax)
|