From bbbd37520dfe6c4a3ea457d9fe046ff1ecb01a47 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Fri, 27 Sep 2024 14:20:09 +0200 Subject: [PATCH] bugfix date --- lightweight_charts/abstract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightweight_charts/abstract.py b/lightweight_charts/abstract.py index 4ab9d13..fdec43d 100644 --- a/lightweight_charts/abstract.py +++ b/lightweight_charts/abstract.py @@ -202,7 +202,7 @@ class SeriesCommon(Pane): self._set_interval(df) if not pd.api.types.is_datetime64_any_dtype(df['time']): df['time'] = pd.to_datetime(df['time']) - df['time'] = df['time'].astype('int64') / 10 ** 9 #removed integer divison // 10 ** 9 to keep subseconds precision + df['time'] = (df['time'].astype('int64') / 10 ** 6).astype(float) # if 'updated' in df.columns: # df['updated'] = pd.to_datetime(df['updated']).astype('int64') / 10**9 @@ -213,7 +213,7 @@ class SeriesCommon(Pane): if col == 'time' or not pd.api.types.is_datetime64_any_dtype(df[col]): continue # Convert datetime to timestamp with nanosecond precision after the decimal - df[col] = pd.to_datetime(df[col]).astype('int64') / 10**9 + df[col] = (pd.to_datetime(df[col]).astype('int64') / 10**6).astype(float) return df