-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
DOC: fix Index.to_frame name parameter description #64105
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
base: main
Are you sure you want to change the base?
DOC: fix Index.to_frame name parameter description #64105
Conversation
The `name` parameter's type was documented as `object` but the actual type annotation is `Hashable`. The default value was described as `index.name` but the actual default is `lib.no_default`. Closes pandas-dev#63191 Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
pandas/core/indexes/base.py
Outdated
| Set the index of the returned DataFrame as the original Index. | ||
|
|
||
| name : object, defaults to index.name | ||
| name : Hashable, default lib.no_default |
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.
lib.no_default is a meaningless (to users) sentinel value to mean the default behaviour, and should not be used in the explanation. I think the current wording is fine. Or if we want to use something else, it could be , optional (to indicate it is optional to specify the argument, while the method still has some default behaviour when it is not specified)
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.
Thank you for the review. You're right — \ is an internal sentinel and shouldn't appear in user-facing docs. I've reverted the default description to the original wording and kept only the type change (\ → ).
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.
Thank you for the review. You are right, lib.no_default is an internal sentinel and should not appear in user-facing docs. I have reverted the default description to the original wording and kept only the type change (object to Hashable).
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.
Thank you for the review. You are right, lib.no_default is an internal sentinel and should not appear in user-facing docs. I have reverted the default description to the original wording and kept only the type change (object to Hashable).
Address review: lib.no_default is an internal sentinel, not for user docs. Reverted default description to original "defaults to index.name". Kept type change: object → Hashable. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Closes #63191.
The
nameparameter inIndex.to_framehad two inaccuracies in its docstring:object, but the actual type annotation isHashableindex.name, but the actual default islib.no_defaultFixed both and added a clarifying sentence about the fallback behavior.