Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -169,6 +169,9 @@ with st.expander("๐ ์์ฆ๋๋ฆฌํฐ & ํจํด ์ค๋ช
"):
|
|
169 |
f"**์ฐ๊ฐ ์ ์ ์:** {int(month_season.idxmin())}์ \n"
|
170 |
f"**์ฐ๊ฐ ๋ณ๋ํญ:** {month_season.max() - month_season.min():.1f}")
|
171 |
|
|
|
|
|
|
|
172 |
# -------------------------------------------------
|
173 |
# CORRELATION HEATMAP -----------------------------
|
174 |
# -------------------------------------------------
|
@@ -180,4 +183,29 @@ monthly_pivot = (raw_df.assign(month=lambda d: d.date.dt.to_period("M"))
|
|
180 |
corr = monthly_pivot.corr()
|
181 |
fig, ax = plt.subplots(figsize=(12, 10))
|
182 |
mask = np.triu(np.ones_like(corr, dtype=bool))
|
183 |
-
sns.heatmap(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
f"**์ฐ๊ฐ ์ ์ ์:** {int(month_season.idxmin())}์ \n"
|
170 |
f"**์ฐ๊ฐ ๋ณ๋ํญ:** {month_season.max() - month_season.min():.1f}")
|
171 |
|
172 |
+
# -------------------------------------------------
|
173 |
+
# CORRELATION HEATMAP -----------------------------
|
174 |
+
# -------------------------------------------------
|
175 |
# -------------------------------------------------
|
176 |
# CORRELATION HEATMAP -----------------------------
|
177 |
# -------------------------------------------------
|
|
|
183 |
corr = monthly_pivot.corr()
|
184 |
fig, ax = plt.subplots(figsize=(12, 10))
|
185 |
mask = np.triu(np.ones_like(corr, dtype=bool))
|
186 |
+
sns.heatmap(corr, mask=mask, annot=False, cmap="coolwarm", center=0,
|
187 |
+
square=True, linewidths=.5, cbar_kws={"shrink": .5})
|
188 |
+
|
189 |
+
# Highlight correlations with selected item
|
190 |
+
if selected_item in corr.columns:
|
191 |
+
item_corr = corr[selected_item].sort_values(ascending=False)
|
192 |
+
top_corr = item_corr.drop(selected_item).head(5)
|
193 |
+
bottom_corr = item_corr.drop(selected_item).tail(5)
|
194 |
+
|
195 |
+
col1, col2 = st.columns(2)
|
196 |
+
with col1:
|
197 |
+
st.markdown(f"**{selected_item}์ ์๊ด๊ด๊ณ ๋์ ํ๋ชฉ**")
|
198 |
+
for item, val in top_corr.items():
|
199 |
+
st.write(f"{item}: {val:.2f}")
|
200 |
+
with col2:
|
201 |
+
st.markdown(f"**{selected_item}์ ์๊ด๊ด๊ณ ๋ฎ์ ํ๋ชฉ**")
|
202 |
+
for item, val in bottom_corr.items():
|
203 |
+
st.write(f"{item}: {val:.2f}")
|
204 |
+
|
205 |
+
st.pyplot(fig)
|
206 |
+
|
207 |
+
# -------------------------------------------------
|
208 |
+
# FOOTER ------------------------------------------
|
209 |
+
# -------------------------------------------------
|
210 |
+
st.markdown("---")
|
211 |
+
st.caption("ยฉ 2024 ํ๋ชฉ๋ณ ๊ฐ๊ฒฉ ์์ธก ์์คํ
| ๋ฐ์ดํฐ ๋ถ์ ์๋ํ")
|