Skip to content

Commit

Permalink
GH60942 Update docs and overload for Series.rename (#60975)
Browse files Browse the repository at this point in the history
* 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 <10647082+mroeschke@users.noreply.github.com>

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
  • Loading branch information
loicdiridollou and mroeschke authored Feb 22, 2025
1 parent f46d853 commit 48b1571
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4651,7 +4651,7 @@ def rename(
inplace: Literal[True],
level: Level | None = ...,
errors: IgnoreRaise = ...,
) -> None: ...
) -> Series | None: ...

@overload
def rename(
Expand All @@ -4665,18 +4665,6 @@ def rename(
errors: IgnoreRaise = ...,
) -> Series: ...

@overload
def rename(
self,
index: Renamer | Hashable | None = ...,
*,
axis: Axis | None = ...,
copy: bool | lib.NoDefault = ...,
inplace: bool = ...,
level: Level | None = ...,
errors: IgnoreRaise = ...,
) -> Series | None: ...

def rename(
self,
index: Renamer | Hashable | None = None,
Expand Down Expand Up @@ -4734,8 +4722,9 @@ def rename(
Returns
-------
Series or None
Series with index labels or name altered or None if ``inplace=True``.
Series
A shallow copy with index labels or name altered, or the same object
if ``inplace=True`` and index is not a dict or callable else None.
See Also
--------
Expand Down

0 comments on commit 48b1571

Please sign in to comment.