Skip to content

Commit bed37e7

Browse files
committed
ENH: Enabled prefix, suffix, and sep to DataFrame. shift with iterable periods (#61696)
1 parent 21bc7d8 commit bed37e7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/core/generic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10112,13 +10112,17 @@ def mask(
1011210112
)
1011310113

1011410114
@doc(klass=_shared_doc_kwargs["klass"])
10115+
if self.ndim == 1 and (prefix or suffix):
10116+
raise ValueError("`prefix` and `suffix` are only supported on DataFrame.shift when `periods` is a list. ")
1011510117
def shift(
1011610118
self,
1011710119
periods: int | Sequence[int] = 1,
1011810120
freq=None,
1011910121
axis: Axis = 0,
1012010122
fill_value: Hashable = lib.no_default,
10123+
prefix: str | None = None,
1012110124
suffix: str | None = None,
10125+
sep: str = "_"
1012210126
) -> Self | DataFrame:
1012310127
"""
1012410128
Shift index by desired number of periods with an optional time `freq`.

0 commit comments

Comments
 (0)