-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add drop_existing kwarg to set_xindex
#11008
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?
Conversation
drop_existing kwarg to set_xindex
benbovy
left a comment
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 @ianhi, I think that this is a convenient addition!
I'd just rename drop_existing to simply drop. The latter is a bit less self-explanatory but more consistent with the rest of the Xarray API where drop is already a parameter of many methods like .reset_index, .reset_coords, .isel, .where, etc.
|
just to confirm — and I left a comment at #11007, so possibly folks saw this — we're sure this shouldn't replace by default? currently the closest function is |
I don't have strong opinions on this, we could replace it by default indeed. It might break the workflow of some users who rely on explicit-only index replacement as a safety guard, however to my knowledge people are actually rather annoyed by that (including me :-)). |
|
re the default I was defaulting to being cautious given xarray's large userbase. But I think it's in general a large user base, perhaps not for this specific function. I agree that a default of |
Yes I think we are! |
|
(this might be going too far, but we may not even need the |
drop_existingtoset_xindex#11007whats-new.rstapi.rst