Skip to content

Commit

Permalink
AttributeError: 'DateTimeNameSpace' object has no attribute 'seconds'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdancho84 committed Jul 18, 2024
1 parent 46b231b commit 2336c30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pytimetk/feature_engineering/fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ 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"):
for K_val in range(1, max_order + 1):
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'])



0 comments on commit 2336c30

Please sign in to comment.