Skip to content

Commit 1b79a21

Browse files
GH60942 Revert removal of overloads
1 parent af68e19 commit 1b79a21

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

pandas/core/series.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4641,6 +4641,31 @@ def _needs_reindex_multi(self, axes, method, level) -> bool:
46414641
"""
46424642
return False
46434643

4644+
@overload
4645+
def rename(
4646+
self,
4647+
index: Renamer | Hashable | None = ...,
4648+
*,
4649+
axis: Axis | None = ...,
4650+
copy: bool | lib.NoDefault = ...,
4651+
inplace: Literal[True],
4652+
level: Level | None = ...,
4653+
errors: IgnoreRaise = ...,
4654+
) -> Series | None: ...
4655+
4656+
@overload
4657+
def rename(
4658+
self,
4659+
index: Renamer | Hashable | None = ...,
4660+
*,
4661+
axis: Axis | None = ...,
4662+
copy: bool | lib.NoDefault = ...,
4663+
inplace: Literal[False] = ...,
4664+
level: Level | None = ...,
4665+
errors: IgnoreRaise = ...,
4666+
) -> Series: ...
4667+
4668+
46444669
def rename(
46454670
self,
46464671
index: Renamer | Hashable | None = None,
@@ -4650,7 +4675,7 @@ def rename(
46504675
inplace: bool = False,
46514676
level: Level | None = None,
46524677
errors: IgnoreRaise = "ignore",
4653-
) -> Series:
4678+
) -> Series | None:
46544679
"""
46554680
Alter Series index labels or name.
46564681
@@ -4699,8 +4724,8 @@ def rename(
46994724
Returns
47004725
-------
47014726
Series
4702-
Series with index labels or name altered as a copy or the same object
4703-
if ``inplace=True``.
4727+
Series with index labels or name altered as a copy, the same object
4728+
if ``inplace=True`` and index is not a dict or callage else None.
47044729
47054730
See Also
47064731
--------

0 commit comments

Comments
 (0)