Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,7 +105,7 @@ def plot_correlation(df, column):
|
|
| 105 |
plt.xlabel("Index")
|
| 106 |
plt.ylabel(column)
|
| 107 |
plt.title(f"Correlation Plot of {column}")
|
| 108 |
-
|
| 109 |
|
| 110 |
|
| 111 |
def main():
|
|
@@ -166,14 +166,19 @@ def main():
|
|
| 166 |
correlation = warehouse_df[warehouse_column].corr(industry_df[industry_column])
|
| 167 |
st.header("Correlation")
|
| 168 |
st.write(f"The correlation between {warehouse_column} in warehouse item stocks and {industry_column} in industry item stocks is: {correlation}")
|
|
|
|
|
|
|
| 169 |
|
| 170 |
# Show correlation plot for each dataset
|
| 171 |
-
if st.button("Show for each dataset
|
|
|
|
| 172 |
st.subheader("Correlation Plot for Warehouse Dataset")
|
| 173 |
-
plot_correlation(warehouse_df, warehouse_column)
|
|
|
|
| 174 |
|
| 175 |
st.subheader("Correlation Plot for Industry Dataset")
|
| 176 |
-
plot_correlation(industry_df, industry_column)
|
|
|
|
| 177 |
|
| 178 |
if __name__ == "__main__":
|
| 179 |
main()
|
|
|
|
| 105 |
plt.xlabel("Index")
|
| 106 |
plt.ylabel(column)
|
| 107 |
plt.title(f"Correlation Plot of {column}")
|
| 108 |
+
return plt.gcf() # Return the matplotlib figure
|
| 109 |
|
| 110 |
|
| 111 |
def main():
|
|
|
|
| 166 |
correlation = warehouse_df[warehouse_column].corr(industry_df[industry_column])
|
| 167 |
st.header("Correlation")
|
| 168 |
st.write(f"The correlation between {warehouse_column} in warehouse item stocks and {industry_column} in industry item stocks is: {correlation}")
|
| 169 |
+
st.write()
|
| 170 |
+
|
| 171 |
|
| 172 |
# Show correlation plot for each dataset
|
| 173 |
+
if st.button("Show for each dataset
|
| 174 |
+
|
| 175 |
st.subheader("Correlation Plot for Warehouse Dataset")
|
| 176 |
+
warehouse_corr_plot = plot_correlation(warehouse_df, warehouse_column)
|
| 177 |
+
st.pyplot(warehouse_corr_plot)
|
| 178 |
|
| 179 |
st.subheader("Correlation Plot for Industry Dataset")
|
| 180 |
+
industry_corr_plot = plot_correlation(industry_df, industry_column)
|
| 181 |
+
st.pyplot(industry_corr_plot)
|
| 182 |
|
| 183 |
if __name__ == "__main__":
|
| 184 |
main()
|