Uh oh!
There was an error while loading. Please reload this page.
Add drop_isel - #4819
Conversation
- Use get_index(dim) in drop_sel - Add drop_isel
47cbca9 to
1617485CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mathause
commented
Jan 17, 2021
LGTM!
Just to add on to this - the wrapper can be written as: classDataArray:
...
defdrop_isel(self, indexers=None, **indexers_kwargs):
"""Drop index positions from this dataset. ... """dataset=self._to_temp_dataset()
dataset=dataset.drop_isel(indexers=indexers, **indexers_kwargs)
returnself._from_temp_dataset(dataset)
... |
mesejo
commented
Jan 18, 2021
Thanks for the feedback. I've addressed the issues. |
mathause
left a comment
There was a problem hiding this comment.
LGTM. I added two suggestions but it's also fine to merge as is.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
keewis
left a comment
There was a problem hiding this comment.
I think there are a few more issues we should address in a new PR
| A (x, y) int64 0 2 3 5 | ||
| """ | ||
| indexers = either_dict_or_kwargs(indexers, indexers_kwargs, "drop") |
There was a problem hiding this comment.
| indexers=either_dict_or_kwargs(indexers, indexers_kwargs, "drop") | |
| indexers=either_dict_or_kwargs(indexers, indexers_kwargs, "drop_isel") |
There was a problem hiding this comment.
This one we should change — @mesejo would you be up for putting the one-line PR in?
There was a problem hiding this comment.
Yes, I can do it. No problem, but just to be sure, drop_sel also has:labels = either_dict_or_kwargs(labels, labels_kwargs, "drop")
Should I change it also? BTW drop_sel also uses np.random.randn in the docstrings should I change this also?
There was a problem hiding this comment.
Ah, good spot, that's a mistake, it should be "drop_sel")
We're trying to move away from random values in the docstrings, but it's not urgent — if you can that would be appreciated, but correcting this & #4819 (comment) is fine to do alone.
Thank you!
| def test_drop_index_positions(self): | ||
| arr = DataArray(np.random.randn(2, 3), dims=["x", "y"]) | ||
| actual = arr.drop_sel(y=[0, 1]) |
There was a problem hiding this comment.
is it intentional that you use drop_sel here? This succeeds because of the change to Edit: as it turns out, self.get_index(dim) in drop_sel, but it really should fail.drop_sel is consistent with sel now, so I guess it makes sense that this does not fail. However, since the test is called test_drop_index_positions I still think this is a typo:
| actual=arr.drop_sel(y=[0, 1]) | |
| actual=arr.drop_isel(y=[0, 1]) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
max-sixty
commented
Jan 19, 2021
Thanks for spotting these @keewis, sorry I missed them. On the
I tend to agree, but |
mathause
commented
Jan 19, 2021
I suggested using |
keewis
commented
Jan 19, 2021
I agree it's important to be consistent with Also, neither |
* upstream/master: Bugfix in list_engine (pydata#4811) Add drop_isel (pydata#4819) Fix RST. Remove the references to `_file_obj` outside low level code paths, change to `_close` (pydata#4809)
* upstream/master: speed up the repr for big MultiIndex objects (pydata#4846) dim -> coord in DataArray.integrate (pydata#3993) WIP: backend interface, now it uses subclassing (pydata#4836) weighted: small improvements (pydata#4818) Update related-projects.rst (pydata#4844) iris update doc url (pydata#4845) Faster unstacking (pydata#4746) Allow swap_dims to take kwargs (pydata#4841) Move skip ci instructions to contributing guide (pydata#4829) fix issues in drop_sel and drop_isel (pydata#4828) Bugfix in list_engine (pydata#4811) Add drop_isel (pydata#4819) Fix RST. Remove the references to `_file_obj` outside low level code paths, change to `_close` (pydata#4809)
* master: (458 commits) Add units if "unit" is in the attrs. (pydata#4850) speed up the repr for big MultiIndex objects (pydata#4846) dim -> coord in DataArray.integrate (pydata#3993) WIP: backend interface, now it uses subclassing (pydata#4836) weighted: small improvements (pydata#4818) Update related-projects.rst (pydata#4844) iris update doc url (pydata#4845) Faster unstacking (pydata#4746) Allow swap_dims to take kwargs (pydata#4841) Move skip ci instructions to contributing guide (pydata#4829) fix issues in drop_sel and drop_isel (pydata#4828) Bugfix in list_engine (pydata#4811) Add drop_isel (pydata#4819) Fix RST. Remove the references to `_file_obj` outside low level code paths, change to `_close` (pydata#4809) fix decode for scale/ offset list (pydata#4802) Expand user dir paths (~) in open_mfdataset and to_zarr. (pydata#4795) add a version info step to the upstream-dev CI (pydata#4815) fix the ci trigger action (pydata#4805) scatter plot by order of the first appearance of hue (pydata#4723) ...
pre-commit run --all-fileswhats-new.rstapi.rst