Skip to content
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

inplace argument for fun like drop #8470

Closed
ggrrll opened this issue Nov 20, 2023 · 3 comments
Closed

inplace argument for fun like drop #8470

ggrrll opened this issue Nov 20, 2023 · 3 comments
Labels
enhancement plan to close May be closeable, needs more eyeballs

Comments

@ggrrll
Copy link

ggrrll commented Nov 20, 2023

Is your feature request related to a problem?

there should be a inplace arg , to avoid re assigning the variable

Describe the solution you'd like

inplace=True argument, in functions like .drop ...

Additional context

related to #3260 , ...

Copy link

welcome bot commented Nov 20, 2023

Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!

@keewis
Copy link
Collaborator

keewis commented Nov 20, 2023

thanks for the suggestion. However, considering that we deprecated and removed the inplace parameter a while ago (for example in the issue you linked to), I don't think we will add it back.

You can work around this by assigning the return value of drop to a name or by using call chains:

(
    ds
    .drop_vars("variable")
    .sel(...)
    ...
)
# or
ds = ds.drop_vars("variable")

@keewis keewis added the plan to close May be closeable, needs more eyeballs label Nov 20, 2023
@ggrrll
Copy link
Author

ggrrll commented Nov 20, 2023

ok thanks -- well, that's exactly what I wanted to avoid , using the same rationale as pandas drop; feel free to close then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement plan to close May be closeable, needs more eyeballs
Projects
None yet
Development

No branches or pull requests

3 participants