From 2336c308c8644518ea79d555211dbaf3b160ef6f Mon Sep 17 00:00:00 2001 From: Matt Dancho Date: Thu, 18 Jul 2024 10:25:14 -0400 Subject: [PATCH] AttributeError: 'DateTimeNameSpace' object has no attribute 'seconds' --- src/pytimetk/feature_engineering/fourier.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pytimetk/feature_engineering/fourier.py b/src/pytimetk/feature_engineering/fourier.py index 87791457..113e6029 100644 --- a/src/pytimetk/feature_engineering/fourier.py +++ b/src/pytimetk/feature_engineering/fourier.py @@ -215,7 +215,7 @@ def _augment_fourier_polars( # Convert dates to numeric representation min_date = df[date_column].min() - df = df.with_columns((2 * np.pi * (df[date_column] - min_date).dt.seconds() / scale_factor).rename('radians')) + df = df.with_columns((2 * np.pi * (df[date_column] - min_date).dt.total_seconds() / scale_factor).rename('radians')) # Compute Fourier series for type_val in ("sin", "cos"): @@ -223,7 +223,7 @@ def _augment_fourier_polars( for period_val in periods: df = df.with_columns(calc_fourier(x = df['radians'], period = period_val, type = type_val, K = K_val).rename(f'{date_column}_{type_val}_{K_val}_{period_val}')) - return df.drop(columns=['radians']).to_pandas() + return df.to_pandas().drop(columns=['radians'])