home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 253975242 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 2

  • shoyer 3
  • fujiisoup 2

issue 1

  • Boolean indexing 'by' xr.DataArray · 5 ✖

author_association 1

  • MEMBER 5
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
326164860 https://github.com/pydata/xarray/issues/1537#issuecomment-326164860 https://api.github.com/repos/pydata/xarray/issues/1537 MDEyOklzc3VlQ29tbWVudDMyNjE2NDg2MA== fujiisoup 6815844 2017-08-31T01:39:00Z 2017-08-31T01:39:00Z MEMBER

Thanks for the investigation. This is strange.

I raised an issue in https://github.com/numpy/numpy/issues/9633. As it is clear xarray cannot do anything about it, I close this issue.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Boolean indexing 'by' xr.DataArray 253975242
326157538 https://github.com/pydata/xarray/issues/1537#issuecomment-326157538 https://api.github.com/repos/pydata/xarray/issues/1537 MDEyOklzc3VlQ29tbWVudDMyNjE1NzUzOA== shoyer 1217238 2017-08-31T00:44:41Z 2017-08-31T00:44:41Z MEMBER

OK, here we go: ``` In [25]: class GoodWrappedArray(object): ...: def init(self, array): ...: self.array = array ...: def array(self, dtype=None): ...: return np.asarray(self.array, dtype) ...: def getitem(self, key): ...: return self.array[key] ...: def len(self): ...: return len(self.array) ...:

In [26]: ind = GoodWrappedArray(np.array([True, False, True]))

In [27]: np.arange(3)[ind] Out[27]: array([0, 2])

In [28]: class BadWrappedArray(object): ...: def init(self, array): ...: self.array = array ...: def array(self, dtype=None): ...: return np.asarray(self.array, dtype) ...: def getitem(self, key): ...: return BadWrappedArray(self.array[key]) ...: def len(self): ...: return len(self.array) ...:

In [29]: ind = BadWrappedArray(np.array([True, False, True]))

In [30]: np.arange(3)[ind] Out[32]: array([], shape=(0, 3), dtype=int64) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Boolean indexing 'by' xr.DataArray 253975242
326157080 https://github.com/pydata/xarray/issues/1537#issuecomment-326157080 https://api.github.com/repos/pydata/xarray/issues/1537 MDEyOklzc3VlQ29tbWVudDMyNjE1NzA4MA== shoyer 1217238 2017-08-31T00:41:25Z 2017-08-31T00:41:25Z MEMBER

Two more clues:

LazilyIndexedArray suffices to duplicate this issue: ``` In [20]: ind = xr.core.indexing.LazilyIndexedArray(np.array([True, False, True]))

In [21]: np.arange(3)[ind] Out[21]: array([], shape=(0, 3), dtype=int64) ```

But this simple array wrapper does not: ``` In [17]: class WrappedArray(object): ...: def init(self, array): ...: self.array = array ...: def array(self, dtype=None): ...: return np.asarray(self.array, dtype) ...: def getitem(self, key): ...: return WrappedArray(self.array[key]) ...: @property ...: def shape(self): ...: return self.array.shape ...: @property ...: def dtype(self): ...: return self.array.dtype ...:

In [18]: ind = WrappedArray(np.array([True, False, True]))

In [19]: np.arange(3)[ind] Out[19]: array([0, 2]) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Boolean indexing 'by' xr.DataArray 253975242
326154495 https://github.com/pydata/xarray/issues/1537#issuecomment-326154495 https://api.github.com/repos/pydata/xarray/issues/1537 MDEyOklzc3VlQ29tbWVudDMyNjE1NDQ5NQ== fujiisoup 6815844 2017-08-31T00:21:53Z 2017-08-31T00:21:53Z MEMBER

I will raise an issue in NumPy. It might better if we could tell which part of our code causes this bug. (And if we can avoid it within our code, it might be much quicker) Do you have any idea?

I confirmed + indexing by a Variable already causes this bug + only simple subclassing common.AbstractArray and utils.NdimSizeLenMixin does not cause this.

I suspect something related to Variable interpretation could trigger it.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Boolean indexing 'by' xr.DataArray 253975242
326037970 https://github.com/pydata/xarray/issues/1537#issuecomment-326037970 https://api.github.com/repos/pydata/xarray/issues/1537 MDEyOklzc3VlQ29tbWVudDMyNjAzNzk3MA== shoyer 1217238 2017-08-30T16:01:32Z 2017-08-30T16:01:32Z MEMBER

I think this is probably an upstream (numpy) bug. Indexing a NumPy array by an array-like object should be equivalent to casting it to a numpy array, i.e., array[np.asarray(ind)].

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Boolean indexing 'by' xr.DataArray 253975242

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

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]);
Powered by Datasette · Queries took 11.035ms · About: xarray-datasette