Skip to content

DOC: DataFrame.reindex improve summary and return type #34584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4239,11 +4239,11 @@ def sort_values(

def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries:
"""
Conform %(klass)s to new index with optional filling logic.
Create an object with a new index and columns retained from %(klass)s.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not true, you can specify index and/or columns.


Places NA/NaN in locations having no value in the previous index. A new object
is produced unless the new index is equivalent to the current one and
``copy=False``.
The values are only retained for index that matches in %(klass)s else NA/Nan.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you say what the intent is here?

If the new index is entirely equivalent to the current one and copy=false the
%(klass)s remains intact.

Parameters
----------
Expand Down Expand Up @@ -4286,7 +4286,7 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries:

Returns
-------
%(klass)s with changed index.
%(klass)s with a new index.

See Also
--------
Expand Down