-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 drop=True argument to isel, sel and squeeze #1153
Conversation
Fixes GH242 This is useful for getting rid of extraneous scalar variables that arise from indexing, and in particular will resolve an issue for optional indexes: pydata#1017 (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.
This looks quite nice. Just expand the tests for squeeze
a bit and we're good to go.
expected = Dataset({'foo': 1}, {'x': 0}) | ||
selected = data.squeeze(drop=False) | ||
self.assertDatasetIdentical(expected, selected) | ||
|
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.
Can you add a few more tests to this section:
- squeeze empty array
- squeeze 2d array with a single element
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.
done
Going to merge this shortly unless anyone has objections |
@shoyer, I think this is really great and appreciate you doing this awesome work. I obviously have a vested interest in the |
Well, to be clear For |
Fixes #242
This is useful for getting rid of extraneous scalar variables that arise from
indexing, and in particular will resolve an issue for optional indexes:
#1017 (comment)