-
Notifications
You must be signed in to change notification settings - Fork 914
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
Add ability to modify and propagate names
of columns
object
#17597
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
/okay to test |
/okay to test |
@@ -207,11 +207,16 @@ def _from_columns_like_self( | |||
|
|||
@property | |||
def level_names(self) -> tuple[abc.Hashable, ...]: | |||
if self.is_cached("to_pandas_index"): | |||
return self.to_pandas_index.names |
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.
Is there any particular reason we want/need to use the cached to_pandas_index
here?
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.
Yes, when updates to the pandas object created by to_pandas_index
are performed, we need the updated names
, that's what this piece of code does.
I think this may close #14012 too |
Co-authored-by: Matthew Roeschke <[email protected]>
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.
Just https://github.com/rapidsai/cudf/pull/17597/files#r1887795031 otherwise LGTM
Co-authored-by: Matthew Roeschke <[email protected]>
Done 👍 Sorry that slipped my radar. |
/merge |
Description
Fixes: #17482, #14012
This PR fixes a long-standing issue where modifying
columns
name
never propagates to the parent object. This PR fixes this issue by makingto_pandas_index
a cached-property and accessing it's names if this property was ever invoked inlevel_names
property.Checklist