From c3bc4157c59b724ac1cfa7332287b17b6133298c Mon Sep 17 00:00:00 2001 From: XiaotianZha Date: Thu, 16 Oct 2025 10:05:24 +0800 Subject: [PATCH] Update collector.py To fix timestamp format problem ValueError: unconverted data remains when parsing with format "%Y-%m-%d": " 09:30:00-04:00", at position 109. You might want to try: - passing `format` if your strings have a consistent format; - passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format; - passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this. --- scripts/data_collector/yahoo/collector.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/data_collector/yahoo/collector.py b/scripts/data_collector/yahoo/collector.py index a1b4d64f65..b77537700e 100644 --- a/scripts/data_collector/yahoo/collector.py +++ b/scripts/data_collector/yahoo/collector.py @@ -392,7 +392,8 @@ def normalize_yahoo( columns = copy.deepcopy(YahooNormalize.COLUMNS) df = df.copy() df.set_index(date_field_name, inplace=True) - df.index = pd.to_datetime(df.index) + df.index = df.index.astype(str) + df.index = pd.to_datetime(df.index.str[:10], format="%Y-%m-%d") df.index = df.index.tz_localize(None) df = df[~df.index.duplicated(keep="first")] if calendar_list is not None: