Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,8 +23,9 @@ selected_data_type = st.selectbox("Select Data Type:", ["Monthly", "Yearly"])
|
|
| 23 |
if st.button("Submit"):
|
| 24 |
if selected_data_type == "Monthly":
|
| 25 |
df_selected = df_monthly[df_monthly["Shop Code"] == selected_index]
|
|
|
|
| 26 |
plt.figure(figsize=(10, 6))
|
| 27 |
-
plt.bar(df_selected.columns[1:], df_selected.iloc[0, 1:])
|
| 28 |
plt.title(f"Monthly Sales Data for Shop Code {selected_index}")
|
| 29 |
plt.xlabel("Months")
|
| 30 |
plt.ylabel("Sales Amount")
|
|
@@ -33,10 +34,11 @@ if st.button("Submit"):
|
|
| 33 |
|
| 34 |
elif selected_data_type == "Yearly":
|
| 35 |
df_selected = df_yearly[df_yearly["Shop Code"] == selected_index]
|
|
|
|
| 36 |
plt.figure(figsize=(10, 6))
|
| 37 |
-
plt.bar(df_selected.columns[1:], df_selected.iloc[0, 1:])
|
| 38 |
plt.title(f"Yearly Sales Data for Shop Code {selected_index}")
|
| 39 |
plt.xlabel("Years")
|
| 40 |
plt.ylabel("Sales Amount")
|
| 41 |
plt.xticks(rotation=90, ha="right")
|
| 42 |
-
st.pyplot()
|
|
|
|
| 23 |
if st.button("Submit"):
|
| 24 |
if selected_data_type == "Monthly":
|
| 25 |
df_selected = df_monthly[df_monthly["Shop Code"] == selected_index]
|
| 26 |
+
df_selected = df_selected.astype(str) # Convert to string
|
| 27 |
plt.figure(figsize=(10, 6))
|
| 28 |
+
plt.bar(df_selected.columns[1:], df_selected.iloc[0, 1:].astype(float))
|
| 29 |
plt.title(f"Monthly Sales Data for Shop Code {selected_index}")
|
| 30 |
plt.xlabel("Months")
|
| 31 |
plt.ylabel("Sales Amount")
|
|
|
|
| 34 |
|
| 35 |
elif selected_data_type == "Yearly":
|
| 36 |
df_selected = df_yearly[df_yearly["Shop Code"] == selected_index]
|
| 37 |
+
df_selected = df_selected.astype(str) # Convert to string
|
| 38 |
plt.figure(figsize=(10, 6))
|
| 39 |
+
plt.bar(df_selected.columns[1:], df_selected.iloc[0, 1:].astype(float))
|
| 40 |
plt.title(f"Yearly Sales Data for Shop Code {selected_index}")
|
| 41 |
plt.xlabel("Years")
|
| 42 |
plt.ylabel("Sales Amount")
|
| 43 |
plt.xticks(rotation=90, ha="right")
|
| 44 |
+
st.pyplot()
|