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

Fix dataarray drop attrs #10030

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

j-haacker
Copy link

This PR is related to Issue #10027

It fixes the issue and adds tests to prevent similar issues in future.

I did not document the change in whats-new.

I'm also not 100 % happy with the solution. I would welcome an experienced contributor to review the changes.

Copy link

welcome bot commented Feb 6, 2025

Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient.
If you have questions, some answers may be found in our contributing guidelines.

)
if not deep:
for k in list(self.attrs):
del self.attrs[k]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That changes the data array inplace which is something we try to avoid.
Can you return a copy instead while leaving the original one intact?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataArray().drop_attrs(deep=False) doesn't do anything
2 participants