home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 409906674 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 4

  • shoyer 2
  • dcherian 1
  • max-sixty 1
  • andrew-c-ross 1

author_association 2

  • MEMBER 4
  • CONTRIBUTOR 1

issue 1

  • xarray .count() gives -1 when it should be 1? · 5 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
464190675 https://github.com/pydata/xarray/issues/2770#issuecomment-464190675 https://api.github.com/repos/pydata/xarray/issues/2770 MDEyOklzc3VlQ29tbWVudDQ2NDE5MDY3NQ== dcherian 2448579 2019-02-15T20:37:34Z 2019-02-15T20:37:34Z MEMBER

Though for datetime64 we should use ~np.nat?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray .count() gives -1 when it should be 1?  409906674
464189040 https://github.com/pydata/xarray/issues/2770#issuecomment-464189040 https://api.github.com/repos/pydata/xarray/issues/2770 MDEyOklzc3VlQ29tbWVudDQ2NDE4OTA0MA== shoyer 1217238 2019-02-15T20:31:15Z 2019-02-15T20:31:15Z MEMBER

Apparently isnull(datetime64_scalar_array) returns a Python boolean False. This gets inverted by ~ to -1 instead of True in our implementation of count: https://github.com/pydata/xarray/blob/4cd56a9edb083a3eb8d11e7a367dfb9bda76fc2e/xarray/core/duck_array_ops.py#L188

To fix this, we should either switch ~x to np.logical_not(x).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray .count() gives -1 when it should be 1?  409906674
464188585 https://github.com/pydata/xarray/issues/2770#issuecomment-464188585 https://api.github.com/repos/pydata/xarray/issues/2770 MDEyOklzc3VlQ29tbWVudDQ2NDE4ODU4NQ== shoyer 1217238 2019-02-15T20:29:25Z 2019-02-15T20:29:25Z MEMBER

The problem seems to come up for scalar datetime64 arrays: ```

xarray.Variable((), np.datetime64('2000-01-01')).count() -1 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray .count() gives -1 when it should be 1?  409906674
464088384 https://github.com/pydata/xarray/issues/2770#issuecomment-464088384 https://api.github.com/repos/pydata/xarray/issues/2770 MDEyOklzc3VlQ29tbWVudDQ2NDA4ODM4NA== andrew-c-ross 5852283 2019-02-15T15:22:48Z 2019-02-15T15:22:48Z CONTRIBUTOR

I can reproduce OP when the coordinate is a datetime64, but the problem does not occur with int64s (or float64s).

datetime coordinate: ``` In [1]: import xarray

In [2]: xarray.version Out[2]: '0.11.2'

In [3]: import datetime as dt

In [4]: da = xarray.DataArray([0], coords=[('time', [dt.datetime(1979, 1, 1)])])

In [5]: da.isel(time=0).time.count() Out[5]: <xarray.DataArray 'time' ()> array(-1) Coordinates: time datetime64[ns] 1979-01-01 ```

int coordinate:

``` In [6]: da = xarray.DataArray([0], coords=[('time', [0])])

In [7]: da.isel(time=0).time.count() Out[7]: <xarray.DataArray 'time' ()> array(1) Coordinates: time int64 0 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray .count() gives -1 when it should be 1?  409906674
463327251 https://github.com/pydata/xarray/issues/2770#issuecomment-463327251 https://api.github.com/repos/pydata/xarray/issues/2770 MDEyOklzc3VlQ29tbWVudDQ2MzMyNzI1MQ== max-sixty 5635139 2019-02-13T19:10:38Z 2019-02-13T19:10:38Z MEMBER

Thanks for the issue @ru111

That does seem weird. Do you have a minimally reproducible example?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray .count() gives -1 when it should be 1?  409906674

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 13.932ms · About: xarray-datasette