issue_comments
13 rows where issue = 294241734 sorted by updated_at descending
This data as json, CSV (advanced)
Suggested facets: reactions, created_at (date), updated_at (date)
issue 1
- Boolean indexing with multi-dimensional key arrays · 13 ✖
id | html_url | issue_url | node_id | user | created_at | updated_at ▲ | author_association | body | reactions | performed_via_github_app | issue |
---|---|---|---|---|---|---|---|---|---|---|---|
825176507 | https://github.com/pydata/xarray/issues/1887#issuecomment-825176507 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNTE3NjUwNw== | max-sixty 5635139 | 2021-04-22T20:50:29Z | 2021-04-22T21:06:47Z | MEMBER |
This could be useful (potentially we can open a different issue). While someone can call |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824782830 | https://github.com/pydata/xarray/issues/1887#issuecomment-824782830 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDc4MjgzMA== | Hoeze 1200058 | 2021-04-22T12:08:45Z | 2021-04-22T12:11:55Z | NONE |
IMO, the perfect solution would be masking support.
I.e. Also, that would avoid all those unnecessary |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824503658 | https://github.com/pydata/xarray/issues/1887#issuecomment-824503658 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDUwMzY1OA== | max-sixty 5635139 | 2021-04-22T03:04:41Z | 2021-04-22T03:04:51Z | MEMBER | I'm still working through this. Using this to jot down my notes, no need to respond. One property that seems to be lacking is that if ```python In [171]: a Out[171]: array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) In [172]: mask Out[172]: array([ True, False, True]) In [173]: a[mask] Out[173]: array([[ 0, 1, 2, 3], [ 8, 9, 10, 11]]) ``` ...as expected, but now let's make a 2D mask... ```python In [174]: full_mask = np.broadcast_to(mask[:, np.newaxis], (3,4)) In [175]: full_mask Out[175]: array([[ True, True, True, True], [False, False, False, False], [ True, True, True, True]]) In [176]: a[full_mask] Out[176]: array([ 0, 1, 2, 3, 8, 9, 10, 11]) # flattened! ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824461333 | https://github.com/pydata/xarray/issues/1887#issuecomment-824461333 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDQ2MTMzMw== | shoyer 1217238 | 2021-04-22T01:02:32Z | 2021-04-22T01:02:32Z | MEMBER |
The part about this new proposal that is most annoying is that the |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824460304 | https://github.com/pydata/xarray/issues/1887#issuecomment-824460304 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDQ2MDMwNA== | shoyer 1217238 | 2021-04-22T00:59:25Z | 2021-04-22T00:59:25Z | MEMBER |
Yes, this looks right to me. |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824454992 | https://github.com/pydata/xarray/issues/1887#issuecomment-824454992 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDQ1NDk5Mg== | max-sixty 5635139 | 2021-04-22T00:40:49Z | 2021-04-22T00:40:49Z | MEMBER |
This was a tiny point so it's fine to discard. I had meant that producing the |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824452843 | https://github.com/pydata/xarray/issues/1887#issuecomment-824452843 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDQ1Mjg0Mw== | max-sixty 5635139 | 2021-04-22T00:33:29Z | 2021-04-22T00:35:28Z | MEMBER | OK great. To confirm, this is what it would look like: Context: ```python In [81]: da = xr.DataArray(np.arange(12).reshape(3,4), dims=list('ab')) In [82]: da Out[82]: <xarray.DataArray (a: 3, b: 4)> array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) Dimensions without coordinates: a, b In [84]: key = da % 3 == 0 In [83]: key Out[83]: <xarray.DataArray (a: 3, b: 4)> array([[ True, False, False, True], [False, False, True, False], [False, True, False, False]]) Dimensions without coordinates: a, b ``` Currently ```python In [85]: da[key]IndexError Traceback (most recent call last) <ipython-input-85-7fd83c907cb6> in <module> ----> 1 da[key] ... ~/.asdf/installs/python/3.8.8/lib/python3.8/site-packages/xarray/core/variable.py in _validate_indexers(self, key) 697 ) 698 if k.ndim > 1: --> 699 raise IndexError( 700 "{}-dimensional boolean indexing is " 701 "not supported. ".format(k.ndim) IndexError: 2-dimensional boolean indexing is not supported. ``` Current proposal (" Previous suggestion (" (small follow up I'll put in another message, for clarity) |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824329772 | https://github.com/pydata/xarray/issues/1887#issuecomment-824329772 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDMyOTc3Mg== | shoyer 1217238 | 2021-04-21T20:16:10Z | 2021-04-21T20:16:10Z | MEMBER |
Here are two reasons why I like the
As a side note: one nice feature of using
To match the semantics of NumPy,
I'm not quite sure this is true -- it's the difference between needing to call |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
824299104 | https://github.com/pydata/xarray/issues/1887#issuecomment-824299104 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyNDI5OTEwNA== | max-sixty 5635139 | 2021-04-21T19:21:46Z | 2021-04-21T19:21:46Z | MEMBER | I've been trying to conceptualize why I think the But I don't do much pointwise indexing — and so maybe we do want to prioritize that |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
823673654 | https://github.com/pydata/xarray/issues/1887#issuecomment-823673654 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgyMzY3MzY1NA== | shoyer 1217238 | 2021-04-20T23:50:34Z | 2021-04-20T23:50:34Z | MEMBER | It's worth noting that there is at least one other way boolean indexing could work:
We can't support both with the same syntax, so we have to make a choice here :). See also the discussion about what |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
803491524 | https://github.com/pydata/xarray/issues/1887#issuecomment-803491524 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDgwMzQ5MTUyNA== | max-sixty 5635139 | 2021-03-21T00:38:23Z | 2021-03-21T00:38:23Z | MEMBER | I've added the "good first issue" label — at least the first two bullets of the proposal would be relatively simple to implement, given they're mostly syntactic sugar. |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
744463486 | https://github.com/pydata/xarray/issues/1887#issuecomment-744463486 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDc0NDQ2MzQ4Ng== | shaprann 43274047 | 2020-12-14T14:07:32Z | 2020-12-14T15:47:18Z | NONE | Just wanted to confirm, that boolean indexing is indeed highly relevant, especially for assigning values instead of just selecting them. Here is a use case which I encounter very often: I'm working with very sparse data (e.g a satellite image of some islands surrounded by water), and I want to modify it using Here is how I would achieve this in numpy: ``` import numpy as np import some_vectorized_function image = np.array( # image.shape == (3, 7, 7) [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 454, 454, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 565, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 343, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]],
) image = np.moveaxis(image, 0, -1) # image.shape == (7, 7, 3) "image" is a standard RGB imagewith shape == (height, width, channel)but only 4 pixels contain relevant data!mask = np.all(image > 0, axis=-1) # mask.shape == (7, 7) # mask.dtype == bool # mask.sum() == 4 image[mask] = some_vectorized_function(image[mask]) # len(image[mask]) == 4 # image[mask].shape == (4, 3) ``` The most important fact here is that Unfortunately, nothing like this is currently possible with XArray. If implemented, it would enable some crazy speedups for operations like spatial interpolation, where we don't want to interpolate the whole image, but only some pixels that we care about. |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 | |
544693024 | https://github.com/pydata/xarray/issues/1887#issuecomment-544693024 | https://api.github.com/repos/pydata/xarray/issues/1887 | MDEyOklzc3VlQ29tbWVudDU0NDY5MzAyNA== | Hoeze 1200058 | 2019-10-21T20:27:14Z | 2019-10-21T20:27:14Z | NONE | Since https://github.com/pydata/xarray/issues/3206 has been implemented now:
Maybe fancy boolean indexing ( |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Boolean indexing with multi-dimensional key arrays 294241734 |
Advanced export
JSON shape: default, array, newline-delimited, object
CREATE TABLE [issue_comments] ( [html_url] TEXT, [issue_url] TEXT, [id] INTEGER PRIMARY KEY, [node_id] TEXT, [user] INTEGER REFERENCES [users]([id]), [created_at] TEXT, [updated_at] TEXT, [author_association] TEXT, [body] TEXT, [reactions] TEXT, [performed_via_github_app] TEXT, [issue] INTEGER REFERENCES [issues]([id]) ); CREATE INDEX [idx_issue_comments_issue] ON [issue_comments] ([issue]); CREATE INDEX [idx_issue_comments_user] ON [issue_comments] ([user]);
user 4