home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where issue = 668717850 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 5

  • aaronspring 3
  • max-sixty 2
  • keewis 2
  • dcherian 1
  • TomNicholas 1

author_association 2

  • MEMBER 6
  • CONTRIBUTOR 3

issue 1

  • bool(Dataset(False)) is True · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
669224849 https://github.com/pydata/xarray/issues/4290#issuecomment-669224849 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2OTIyNDg0OQ== max-sixty 5635139 2020-08-05T14:25:55Z 2020-08-05T14:25:55Z MEMBER

Thanks for raising and engaging @aaronspring !

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
669204458 https://github.com/pydata/xarray/issues/4290#issuecomment-669204458 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2OTIwNDQ1OA== aaronspring 12237157 2020-08-05T13:48:55Z 2020-08-05T13:48:55Z CONTRIBUTOR

For those who think bool(xr.Dataset(dict(x=False))) should evaluate to False, what do you think dict(x=False) should evaluate to?

good point

IIUC, this is somewhat of an edge case — it's only possible to coerce DataArray to bool when there's exactly one element. (Not that we shouldn't resolve)

I now understand the underlying problem better with your comments. My expectations were too naive about it. I cannot evaluate the consequences of changing this. I close this issue and hopefully users having this problem in the future will find this issue.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666637210 https://github.com/pydata/xarray/issues/4290#issuecomment-666637210 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjYzNzIxMA== dcherian 2448579 2020-07-30T19:35:39Z 2020-07-30T19:35:39Z MEMBER

We mirror numpy for DataArray and, per @keewis , Mapping for Dataset. I think we should have a fairly high bar for deviating from those.

:+1:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666610284 https://github.com/pydata/xarray/issues/4290#issuecomment-666610284 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjYxMDI4NA== max-sixty 5635139 2020-07-30T19:10:27Z 2020-07-30T19:10:27Z MEMBER

We mirror numpy for DataArray and, per @keewis , Mapping for Dataset. I think we should have a fairly high bar for deviating from those.

For those who think bool(xr.Dataset(dict(x=False))) should evaluate to False, what do you think dict(x=False) should evaluate to?

IIUC, this is somewhat of an edge case — it's only possible to coerce DataArray to bool when there's exactly one element. (Not that we shouldn't resolve)

This question seems to me to be conceptually similar to the question I described in #3315: "Should we treat a named DataArray and a single-variable Dataset as if they are the same?"

👍

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666546137 https://github.com/pydata/xarray/issues/4290#issuecomment-666546137 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjU0NjEzNw== TomNicholas 35968931 2020-07-30T17:29:43Z 2020-07-30T17:29:43Z MEMBER

This question seems to me to be conceptually similar to the question I described in #3315: "Should we treat a named DataArray and a single-variable Dataset as if they are the same?"

If the answer is yes, then we should definitely change the behaviour of bool(Dataset()) as Aaron suggests. If instead we decide "no, Datasets are dictionaries of DataArrays, and a single-element dictionary is not the same thing as the named object it contains", then I'm not sure.

Intuitively I personally think it should be the former, but I would first like to see how many tests break if we make that kind of change.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666380379 https://github.com/pydata/xarray/issues/4290#issuecomment-666380379 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjM4MDM3OQ== aaronspring 12237157 2020-07-30T13:56:30Z 2020-07-30T14:13:24Z CONTRIBUTOR

currently

python if (xrobject > 10).any(): raise ValueError('blabla') depends on whether xrobject is xr.DataArray or xr.Dataset.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666378592 https://github.com/pydata/xarray/issues/4290#issuecomment-666378592 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjM3ODU5Mg== keewis 14808389 2020-07-30T13:53:25Z 2020-07-30T13:53:25Z MEMBER

I'm not sure if that's something we want to do: what happens if the dataset has more than one variable?

I guess what we're talking about here is making bool(ds) a alias of all(ds.values() or [False]) (the ... or [False] is for making Dataset({}) return False instead of True).

Thoughts, @pydata/xarray?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666370889 https://github.com/pydata/xarray/issues/4290#issuecomment-666370889 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjM3MDg4OQ== aaronspring 12237157 2020-07-30T13:39:55Z 2020-07-30T13:39:55Z CONTRIBUTOR

thanks for the explanation. but from a naive user perspective,

python bool(xr.DataArray(False).to_dataset(name='var')) # False bool(xr.DataArray(True).to_dataset(name='var')) # True bool(xr.DataArray(False)) # False bool(xr.DataArray(True)) # True would be nice.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850
666366366 https://github.com/pydata/xarray/issues/4290#issuecomment-666366366 https://api.github.com/repos/pydata/xarray/issues/4290 MDEyOklzc3VlQ29tbWVudDY2NjM2NjM2Ng== keewis 14808389 2020-07-30T13:31:38Z 2020-07-30T13:31:38Z MEMBER

If I remember correctly, Dataset inherits from dict and doesn't define it's own __bool__, so it has the behavior of dict.__bool__: ```python In [2]: bool(xr.Dataset()) Out[2]: False

In [3]: bool(xr.Dataset({"x": False})) Out[3]: True

In [4]: bool({}) Out[4]: False

In [5]: bool({"x": False}) Out[5]: True ```

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bool(Dataset(False)) is True 668717850

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