yokoha commited on
Commit
762f595
ยท
verified ยท
1 Parent(s): 4a31bd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
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(c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ํ’ˆ๋ชฉ๋ณ„ ๊ฐ€๊ฒฉ ์˜ˆ์ธก ์‹œ์Šคํ…œ | ๋ฐ์ดํ„ฐ ๋ถ„์„ ์ž๋™ํ™”")