Skip to content

Commit

Permalink
FIX-#4425: Add parameters to groupby pct_change. (#4429)
Browse files Browse the repository at this point in the history
Signed-off-by: mvashishtha <[email protected]>
  • Loading branch information
mvashishtha authored and devin-petersohn committed May 4, 2022
1 parent 868882e commit ba68354
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions modin/pandas/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,16 @@ def indices(self):
self._indices_cache = self._compute_index_grouped(numerical=True)
return self._indices_cache

def pct_change(self):
return self._default_to_pandas(lambda df: df.pct_change())
def pct_change(self, periods=1, fill_method="ffill", limit=None, freq=None, axis=0):
return self._default_to_pandas(
lambda df: df.pct_change(
periods=periods,
fill_method=fill_method,
limit=limit,
freq=freq,
axis=axis,
)
)

def filter(self, func, dropna=True, *args, **kwargs):
return self._default_to_pandas(
Expand Down
4 changes: 3 additions & 1 deletion modin/pandas/test/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ def maybe_get_columns(df, by):
eval_general(
modin_groupby,
pandas_groupby,
lambda df: df.pct_change(),
lambda df: df.pct_change(
periods=2, fill_method="pad", limit=1, freq=None, axis=1
),
modin_df_almost_equals_pandas,
is_default=True,
)
Expand Down

0 comments on commit ba68354

Please sign in to comment.