Spaces:
Paused
Paused
Update eda.py
Browse files
eda.py
CHANGED
|
@@ -497,9 +497,12 @@ def render_eda():
|
|
| 497 |
review_kw = st.session_state.eda_filters["review_kw"]
|
| 498 |
|
| 499 |
# Filter frames
|
| 500 |
-
|
| 501 |
if not orders_monthly_all.empty and "month" in orders_monthly_all.columns:
|
| 502 |
-
|
|
|
|
|
|
|
|
|
|
| 503 |
else:
|
| 504 |
orders_monthly_f = pd.DataFrame(columns=["month","count"])
|
| 505 |
|
|
|
|
| 497 |
review_kw = st.session_state.eda_filters["review_kw"]
|
| 498 |
|
| 499 |
# Filter frames
|
| 500 |
+
# Use the already parsed monthly frame above; coerce type defensively and drop NaT before comparing
|
| 501 |
if not orders_monthly_all.empty and "month" in orders_monthly_all.columns:
|
| 502 |
+
if not pd.api.types.is_datetime64_any_dtype(orders_monthly_all["month"]):
|
| 503 |
+
orders_monthly_all["month"] = pd.to_datetime(orders_monthly_all["month"], errors="coerce").dt.floor("D")
|
| 504 |
+
_om = orders_monthly_all.dropna(subset=["month"])
|
| 505 |
+
orders_monthly_f = _om[(_om["month"] >= start_dt) & (_om["month"] <= end_dt)].copy()
|
| 506 |
else:
|
| 507 |
orders_monthly_f = pd.DataFrame(columns=["month","count"])
|
| 508 |
|