Skip to content

Commit 48b1571

Browse files
GH60942 Update docs and overload for Series.rename (#60975)
* Update docs and overload for Series.rename * GH60942 Revert removal of overloads * GH60942 Run pre-commit * Update pandas/core/series.py Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent f46d853 commit 48b1571

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

pandas/core/series.py

+4-15
Original file line numberDiff line numberDiff line change
@@ -4651,7 +4651,7 @@ def rename(
46514651
inplace: Literal[True],
46524652
level: Level | None = ...,
46534653
errors: IgnoreRaise = ...,
4654-
) -> None: ...
4654+
) -> Series | None: ...
46554655

46564656
@overload
46574657
def rename(
@@ -4665,18 +4665,6 @@ def rename(
46654665
errors: IgnoreRaise = ...,
46664666
) -> Series: ...
46674667

4668-
@overload
4669-
def rename(
4670-
self,
4671-
index: Renamer | Hashable | None = ...,
4672-
*,
4673-
axis: Axis | None = ...,
4674-
copy: bool | lib.NoDefault = ...,
4675-
inplace: bool = ...,
4676-
level: Level | None = ...,
4677-
errors: IgnoreRaise = ...,
4678-
) -> Series | None: ...
4679-
46804668
def rename(
46814669
self,
46824670
index: Renamer | Hashable | None = None,
@@ -4734,8 +4722,9 @@ def rename(
47344722
47354723
Returns
47364724
-------
4737-
Series or None
4738-
Series with index labels or name altered or None if ``inplace=True``.
4725+
Series
4726+
A shallow copy with index labels or name altered, or the same object
4727+
if ``inplace=True`` and index is not a dict or callable else None.
47394728
47404729
See Also
47414730
--------

0 commit comments

Comments
 (0)