Skip to content

Commit

Permalink
consistently put None in the metadata for lags if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
vascomedici committed Oct 21, 2024
1 parent 8e4d0f7 commit 4aebcb8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pyforecaster/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,17 @@ def transform(self, x=None, augment=True, simulate=False):
self.logger.info('Added {} to the dataframe'.format(trans_names))

if self.agg_bins is None:
lags_and_fun = product([0] if self.lags is None else self.lags, function_names)
lags_and_fun = product([None] if self.lags is None else self.lags, function_names)
lags_aux = np.array([lf[0] for lf in product([0] if self.lags is None else self.lags, function_names)])

metadata_n = pd.DataFrame(lags_and_fun, columns=['lag', 'function'], index=trans_names)

metadata_n['aggregation_time'] = self.agg_freq
metadata_n['spacing_time'] = pd.Timedelta(spacing_time)
metadata_n['start_time'] = - spacing_time * metadata_n['lag'] - agg_steps * dt + dt
metadata_n['end_time'] = - spacing_time * metadata_n['lag'] + dt

metadata_n['start_time'] = - spacing_time * lags_aux - agg_steps * dt + dt
metadata_n['end_time'] = - spacing_time * lags_aux + dt
print(metadata_n)
else:
lags_expanded = np.outer(lag_steps, np.ones(len(self.agg_bins) - 1)).ravel()
lags_and_fun =product(function_names, lags_expanded)
Expand Down

0 comments on commit 4aebcb8

Please sign in to comment.