Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -392,10 +392,9 @@ def load_all_data(folder_path):
|
|
| 392 |
# 1. Read CSV without parsing dates yet (load as strings to be safe)
|
| 393 |
df = pd.read_csv(file_path, header=0, index_col=0, encoding='utf-8')
|
| 394 |
|
| 395 |
-
# 2.
|
| 396 |
-
# We
|
| 397 |
-
|
| 398 |
-
df.index = pd.to_datetime(df.index, dayfirst=True, errors='coerce')
|
| 399 |
|
| 400 |
# 3. Drop rows with invalid dates
|
| 401 |
df = df[df.index.notna()]
|
|
|
|
| 392 |
# 1. Read CSV without parsing dates yet (load as strings to be safe)
|
| 393 |
df = pd.read_csv(file_path, header=0, index_col=0, encoding='utf-8')
|
| 394 |
|
| 395 |
+
# 2. FORCE ISO PARSING (YYYY-MM-DD)
|
| 396 |
+
# We disable 'dayfirst' because ISO puts Year first.
|
| 397 |
+
df.index = pd.to_datetime(df.index, format='%Y-%m-%d', errors='coerce')
|
|
|
|
| 398 |
|
| 399 |
# 3. Drop rows with invalid dates
|
| 400 |
df = df[df.index.notna()]
|