-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added set_names to dask Index. #6344
base: main
Are you sure you want to change the base?
Conversation
dask/dataframe/core.py
Outdated
result = self.map_partitions(M.set_names, names, level, inplace, meta=meta) | ||
return result | ||
|
||
names = property(fset=set_names, fget=_get_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.
Hmm I don't think this is what we want. IIUC, doing
df.index.names = ['a', 'b']
would operate on a new index object, rather than updating df.index
. Is that correct?
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.
You are right, it is not covering the user case. I noticed the df.index is a property that always returns a new index, that is why the PR does not support any inplace operation.
I have a new commit that caches the df.index and returns it if it exists, otherwise, it does exactly the same as before.
This way it is possible to have inplace operations, but I am not sure if it will cover all the cases. I'll appreciate any feedback you have. Thanks!
Hmm I didn't appreciate that you were working via a Series / DataFrame rather than index directly. In that case, I'd recommend implementing / using |
I have no specific use case, just tried to replicate what was described in the issue. From @cgi1 comment, I suppose
|
Thanks. I think that rename_axis will fit better than adding a method to Index, but perhaps @cgi1 can chime in. |
@matheper are you interested in working on this still? I think that |
I think that we should explicitly not support |
Can one of the admins verify this patch? |
This PR is related to issue #6315.
It aims to add
set_names
method to Dask Index.black dask
/flake8 dask