-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
DOC: Updated set_index doc with a warning #60990
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
Changes from 1 commit
fde5ed8
7281a18
fa65ba5
d053e6c
ff0a805
3b2a9b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5868,6 +5868,10 @@ def set_index( | |
columns or arrays (of the correct length). The index can replace the | ||
existing index or expand on it. | ||
|
||
.. warning:: | ||
Setting a new index will remove the current index column, | ||
unless you first call `reset_index`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only true when
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review. Though it seems redundant with the line you mentioned. When you look at,
it doesn't directly explain the behavior of replacing the existing index (by default). Does this statement makes it clear?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed we should add something here, but saying it is unchanged and columns are added seems inconsistent to me. I also think the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But not strongly opposed to adding elaboration for the True case either. |
||
|
||
Parameters | ||
---------- | ||
keys : label or array-like or list of labels/arrays | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, could you show this as an example in the
Examples
section instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably be removing the warning but I could show an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mroeschke - good here?