Spaces:
Runtime error
Runtime error
bug fix
Browse files
app.py
CHANGED
|
@@ -73,24 +73,29 @@ def generate_plot(df):
|
|
| 73 |
|
| 74 |
# Plot scatter plots for each group
|
| 75 |
axs[0, 0].plot(df.loc[df['Group'] == '4', 'Date'], df.loc[df['Group'] == '4', 'sales'], color='grey')
|
|
|
|
| 76 |
axs[0, 0].set_title('Article Group 1')
|
|
|
|
|
|
|
| 77 |
|
| 78 |
axs[0, 1].plot(df.loc[df['Group'] == '7', 'Date'], df.loc[df['Group'] == '7', 'sales'], color='grey')
|
|
|
|
| 79 |
axs[0, 1].set_title('Article Group 2')
|
|
|
|
|
|
|
| 80 |
|
| 81 |
axs[1, 0].plot(df.loc[df['Group'] == '1', 'Date'], df.loc[df['Group'] == '1', 'sales'], color='grey')
|
|
|
|
| 82 |
axs[1, 0].set_title('Article Group 3')
|
|
|
|
|
|
|
| 83 |
|
| 84 |
axs[1, 1].plot(df.loc[df['Group'] == '6', 'Date'], df.loc[df['Group'] == '6', 'sales'], color='grey')
|
| 85 |
-
axs[1, 1].set_title('Article Group 4')
|
| 86 |
-
|
| 87 |
-
axs[0, 0].plot(df.loc[df['Group'] == '4', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 88 |
-
axs[0, 1].plot(df.loc[df['Group'] == '7', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 89 |
-
axs[1, 0].plot(df.loc[df['Group'] == '1', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 90 |
axs[1, 1].plot(df.loc[df['Group'] == '6', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
-
plt.xticks(rotation=45)
|
| 93 |
-
plt.tight_layout()
|
| 94 |
return fig, axs
|
| 95 |
|
| 96 |
@st.cache_data
|
|
|
|
| 73 |
|
| 74 |
# Plot scatter plots for each group
|
| 75 |
axs[0, 0].plot(df.loc[df['Group'] == '4', 'Date'], df.loc[df['Group'] == '4', 'sales'], color='grey')
|
| 76 |
+
axs[0, 0].plot(df.loc[df['Group'] == '4', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 77 |
axs[0, 0].set_title('Article Group 1')
|
| 78 |
+
axs[0, 0].xticks(rotation=45)
|
| 79 |
+
axs[0, 0].tight_layout()
|
| 80 |
|
| 81 |
axs[0, 1].plot(df.loc[df['Group'] == '7', 'Date'], df.loc[df['Group'] == '7', 'sales'], color='grey')
|
| 82 |
+
axs[0, 1].plot(df.loc[df['Group'] == '7', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 83 |
axs[0, 1].set_title('Article Group 2')
|
| 84 |
+
axs[0, 0].xticks(rotation=45)
|
| 85 |
+
axs[0, 0].tight_layout()
|
| 86 |
|
| 87 |
axs[1, 0].plot(df.loc[df['Group'] == '1', 'Date'], df.loc[df['Group'] == '1', 'sales'], color='grey')
|
| 88 |
+
axs[1, 0].plot(df.loc[df['Group'] == '1', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 89 |
axs[1, 0].set_title('Article Group 3')
|
| 90 |
+
axs[0, 0].xticks(rotation=45)
|
| 91 |
+
axs[0, 0].tight_layout()
|
| 92 |
|
| 93 |
axs[1, 1].plot(df.loc[df['Group'] == '6', 'Date'], df.loc[df['Group'] == '6', 'sales'], color='grey')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
axs[1, 1].plot(df.loc[df['Group'] == '6', 'Date'], df.loc[df['Group'] == '4', 'pred'], color = 'red')
|
| 95 |
+
axs[1, 1].set_title('Article Group 4')
|
| 96 |
+
axs[0, 0].xticks(rotation=45)
|
| 97 |
+
axs[0, 0].tight_layout()
|
| 98 |
|
|
|
|
|
|
|
| 99 |
return fig, axs
|
| 100 |
|
| 101 |
@st.cache_data
|