Skip to content

Commit 5017721

Browse files
fix docstring
1 parent cabd28c commit 5017721

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/core/groupby/groupby.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class providing the base-class of operations.
1010

1111
from collections.abc import (
1212
Hashable,
13+
Iterable,
1314
Iterator,
1415
Mapping,
1516
Sequence,
@@ -4862,7 +4863,7 @@ def cummax(
48624863
@Substitution(name="groupby")
48634864
def shift(
48644865
self,
4865-
periods: int = 1,
4866+
periods: int | Iterable[int] = 1,
48664867
freq=None,
48674868
axis: Axis | lib.NoDefault = lib.no_default,
48684869
fill_value=None,
@@ -4890,6 +4891,10 @@ def shift(
48904891
fill_value : optional
48914892
The scalar value to use for newly introduced missing values.
48924893
4894+
suffix : str, optional
4895+
A string to add to each shifted column if there are multiple periods.
4896+
Ignored otherwise.
4897+
48934898
Returns
48944899
-------
48954900
Series or DataFrame
@@ -4968,6 +4973,7 @@ def shift(
49684973
).add_suffix(f"{suffix}_{period}" if suffix else f"_{period}")
49694974
)
49704975
return concat(shifted_dataframes, axis=1) if shifted_dataframes else self
4976+
periods = cast(int, periods)
49714977

49724978
if freq is not None or axis != 0:
49734979
f = lambda x: x.shift(periods, freq, axis, fill_value)

0 commit comments

Comments
 (0)