diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 03534bbee4c58..0e0b749976f83 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -1230,9 +1230,16 @@ def calc(x): return result - return self._apply_columnwise(homogeneous_func, name, numeric_only)[ - :: self.step - ] + result = self._apply_columnwise(homogeneous_func, name, numeric_only) + if self.step is not None and self.step > 1: + if isinstance(result, pd.Series): + result = result.iloc[::self.step] + elif isinstance(result, pd.DataFrame): + result = result.iloc[::self.step, :] + return result + + + @doc( _shared_docs["aggregate"],