Skip to content

Commit

Permalink
Merge pull request #391 from NannyML/fix/filter-univariate-result
Browse files Browse the repository at this point in the history
Optimize filtering univariate result for period
  • Loading branch information
nnansters authored May 24, 2024
2 parents da33807 + 246ca35 commit 544141d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nannyml/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,15 @@ def _filter(
*args,
**kwargs,
) -> Self:
res = super()._filter(period, *args, **kwargs)
if metrics is None and column_names is None:
return res

if metrics is None:
metrics = [metric.column_name for metric in self.metrics]
if column_names is None:
column_names = self.column_names

res = super()._filter(period, *args, **kwargs)

data = pd.concat([res.data.loc[:, (['chunk'])], res.data.loc[:, (column_names, metrics)]], axis=1)
data = data.reset_index(drop=True)

Expand Down

0 comments on commit 544141d

Please sign in to comment.