Gumball2k5 commited on
Commit
11c1ec2
·
verified ·
1 Parent(s): d411faf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -209,13 +209,34 @@ elif app_section == "Live 5-Day Forecast":
209
  cols = st.columns(5)
210
 
211
  # Lấy giá trị thực tế để so sánh
212
- actual_values = y_test.loc[selected_date_ts].values
213
 
214
  # --- ÁP DỤNG LOGIC (1) TỪ CODE THAM KHẢO ---
215
  # Kiểm tra xem có bất kỳ giá trị 'Actual' nào bị thiếu không
216
- is_partial_forecast = any(pd.isna(v) for v in actual_values)
217
  # ----------------------------------------------
218
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  for i in range(5):
220
  with cols[i]:
221
 
 
209
  cols = st.columns(5)
210
 
211
  # Lấy giá trị thực tế để so sánh
212
+ #actual_values = y_test.loc[selected_date_ts].values
213
 
214
  # --- ÁP DỤNG LOGIC (1) TỪ CODE THAM KHẢO ---
215
  # Kiểm tra xem có bất kỳ giá trị 'Actual' nào bị thiếu không
216
+ #is_partial_forecast = any(pd.isna(v) for v in actual_values)
217
  # ----------------------------------------------
218
+
219
+ # Lấy giá trị thực tế để so sánh
220
+ # --- SỬA LỖI LOGIC: Lấy 'actual_values' từ all_data_df ---
221
+ # Chúng ta cần lấy các cột target (ví dụ: 'temp_next_1_day')
222
+ # từ BẢNG DỮ LIỆU GỐC tại ngày đã chọn.
223
+
224
+ actual_values = []
225
+ if selected_date_ts in all_data_df.index:
226
+ # Lấy 1 dòng từ dataframe gốc
227
+ actual_row = all_data_df.loc[selected_date_ts]
228
+
229
+ # Lấy giá trị từ các cột target (temp_next_1_day, v.v.)
230
+ for col_name in TARGET_COLS:
231
+ actual_values.append(actual_row[col_name])
232
+ else:
233
+ # Trường hợp dự phòng nếu không tìm thấy ngày (dù hiếm)
234
+ actual_values = [float('nan')] * 5 # Tạo 5 giá trị NaN
235
+
236
+ # --- ÁP DỤNG LOGIC (1) TỪ CODE THAM KHẢO ---
237
+ # Kiểm tra xem có bất kỳ giá trị 'Actual' nào bị thiếu không
238
+ is_partial_forecast = any(pd.isna(v) for v in actual_values)
239
+
240
  for i in range(5):
241
  with cols[i]:
242