-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
DOC: Updated set_index doc with a warning #60990
base: main
Are you sure you want to change the base?
Conversation
SaraInCode
commented
Feb 23, 2025
- closes DOC: No warning in set_index() that previous index column is removed. #60973
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
- Added type annotations to new arguments/methods/functions.
@@ -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:: |
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.
Thanks for the PR!
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 comment
The reason will be displayed to describe this comment to others. Learn more.
This is only true when append=False
. As mentioned in the issue, this seems to me to be redundant with the line above:
The index can replace the existing index or expand on it.
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.
Thanks for the review. Though it seems redundant with the line you mentioned. When you look at,
append: bool, default False
Whether to append columns to existing index.
it doesn't directly explain the behavior of replacing the existing index (by default). Does this statement makes it clear?
append: bool, default False
Whether to append new columns to the existing index . If set to True, the current index will remain unchanged and new columns will be added.