Update app.py
Browse files
app.py
CHANGED
@@ -38,21 +38,24 @@ def app():
|
|
38 |
|
39 |
fig, ax = plt.subplots()
|
40 |
|
41 |
-
if "Top Selling" in plot["title"]:
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
if "
|
46 |
-
sns.countplot(data=df, x=plot["x"], hue=plot["hue"])
|
47 |
-
|
48 |
-
|
|
|
49 |
|
|
|
|
|
|
|
50 |
else:
|
51 |
-
ax.set_ylabel("
|
52 |
-
ax.legend(bbox_to_anchor=(1,1))
|
53 |
-
|
54 |
st.pyplot(fig)
|
55 |
-
plt.show()
|
56 |
|
57 |
if __name__ == "__main__":
|
58 |
app()
|
|
|
38 |
|
39 |
fig, ax = plt.subplots()
|
40 |
|
41 |
+
if "Top Selling Pizzas" in plot["title"]:
|
42 |
+
data_aux = df.groupby(plot["x"])[plot["y"]].sum().reset_index().sort_values(by=plot["y"], ascending=False).head(plot["top"])
|
43 |
+
ax.bar(data_aux[plot["x"]].values.tolist(), data_aux[plot["y"]].values.tolist())
|
44 |
+
|
45 |
+
if "Quantity of Pizzas" in plot["title"]:
|
46 |
+
sns.countplot(data=df, x=plot["x"], hue=plot["hue"], ax=ax)
|
47 |
+
|
48 |
+
if "Monthly Revenue" in plot["title"]:
|
49 |
+
sns.lineplot(data=df, x=plot["x"], y=plot["y"], hue=plot["hue"], estimator=plot["estimator"], errorbar=None, marker=plot["marker"], ax=ax)
|
50 |
|
51 |
+
ax.set_xlabel(" ".join(plot["x"].split("_")).capitalize())
|
52 |
+
if "y" in plot.keys():
|
53 |
+
ax.set_ylabel(" ".join(plot["y"].split("_")).capitalize())
|
54 |
else:
|
55 |
+
ax.set_ylabel("Quantity")
|
56 |
+
ax.legend(bbox_to_anchor=(1,1))
|
57 |
+
|
58 |
st.pyplot(fig)
|
|
|
59 |
|
60 |
if __name__ == "__main__":
|
61 |
app()
|