On 17/07/2020 21:11, Todd wrote:
On Fri, Jul 17, 2020 at 12:19 PM David Mertz <me...@gnosis.cx> wrote:
Fwiw, I'm probably -0 on the feature itself. Someone suggested it could be
useful for xarray, but I'm not sure now what that would look like. If
someone had an example, I could easily be moved.
Here is what it currently looks like to assign values to indices in xarray
(adapted from a tutorial):
ds["empty"].loc[dict(lon=5, lat=6)] = 10
This could be changed to:
ds["empty"][lon=5, lat=6] = 10
This becomes even a bigger advantage if we include slicing, which I think
we should:
ds["empty"].loc[dict(lon=slice(1, 5), lat=slice(3, None))] = 10
to
ds["empty"][lon=1:5, lat=6:] = 10
Thanks for posting this. I had been really struggling to see a use case
that made any kind of sense to me, possibly because I am not a data
scientist and have no interest in becoming one. This helped a lot. I
particularly like the slice notation, there is a clear win there.
--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/4M6DCHAEPFXDLDULALZQZCHOFL2ILDJM/
Code of Conduct: http://python.org/psf/codeofconduct/