home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

11 rows where issue = 103055174 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 3

  • jhamman 5
  • shoyer 4
  • clarkfitzg 2

issue 1

  • raise error if dataarray.name is wrong type · 11 ✖

author_association 1

  • MEMBER 11
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
136812613 https://github.com/pydata/xarray/pull/551#issuecomment-136812613 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNjgxMjYxMw== shoyer 1217238 2015-09-01T17:58:35Z 2015-09-01T17:58:35Z MEMBER

@jhamman The problem is these lines in Dataset.__getitem__: https://github.com/xray/xray/blob/v0.6.0/xray/core/dataset.py#L615-L619

We should probably be checking for is_hashable(key) instead of converting to an ndarray, where is_hashable looks something like this: http://stackoverflow.com/a/3460725/809705

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
136588625 https://github.com/pydata/xarray/pull/551#issuecomment-136588625 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNjU4ODYyNQ== jhamman 2443309 2015-09-01T05:13:34Z 2015-09-01T05:13:34Z MEMBER

I started working on a second PR for this issue and ran across this issue:

``` Python In [1]: import numpy as np In [2]: import xray In [3]: data = np.random.random((2, 2)) In [4]: da = xray.DataArray(data) In [5]: ds = xray.Dataset() In [6]: ds[(4, 5)] = da In [7]: print(ds)

traceback shortened


KeyError Traceback (most recent call last) /Users/jhamman/Dropbox/src/xray/xray/core/dataset.py in _get_virtual_variable(variables, key) 37 """ 38 if not isinstance(key, basestring): ---> 39 raise KeyError(key) 40 41 split_key = key.split('.', 1)

KeyError: 4 ```

It looks like we have something else to fix because it is possible to create a dataset that behaves like a dictionary but cant be written to disk or printed.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
136434352 https://github.com/pydata/xarray/pull/551#issuecomment-136434352 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNjQzNDM1Mg== clarkfitzg 5356122 2015-08-31T17:23:10Z 2015-08-31T17:23:10Z MEMBER

variable names must be hashable (and unique)

This makes datasets behave like dictionaries, which are familiar for Python users. A good thing.

raise an error in to_netcdf in the event the variable name is invalid.

@jhamman +1 for this solution

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
136175466 https://github.com/pydata/xarray/pull/551#issuecomment-136175466 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNjE3NTQ2Ng== jhamman 2443309 2015-08-30T19:08:41Z 2015-08-30T19:08:41Z MEMBER

I think I'm starting to fall in line with you here. Perhaps we should just raise an error in to_netcdf in the even the variable name is invalid.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
136121187 https://github.com/pydata/xarray/pull/551#issuecomment-136121187 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNjEyMTE4Nw== shoyer 1217238 2015-08-30T09:51:03Z 2015-08-30T09:51:03Z MEMBER

I'm conflicted about this change. My concern is that the only strict requirement for making a dataset is that the variable names must be hashable (and unique). Yes, you certainly need strings to write netcdfs -- but that's not something everyone uses, and it's usually not much more distruptive to get the error in to_netcdf rather than when creating the dataset. I don't think there are many other places in the code where we need to verify that variable name is a string?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
135196454 https://github.com/pydata/xarray/pull/551#issuecomment-135196454 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNTE5NjQ1NA== jhamman 2443309 2015-08-26T22:32:16Z 2015-08-26T22:32:16Z MEMBER

I think this is ready. Anyone have final comments or concerns?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
135143450 https://github.com/pydata/xarray/pull/551#issuecomment-135143450 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNTE0MzQ1MA== shoyer 1217238 2015-08-26T19:13:18Z 2015-08-26T19:13:18Z MEMBER

Nope, the elements in new_coords_names are a subset of the keys of new_variables.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
135143005 https://github.com/pydata/xarray/pull/551#issuecomment-135143005 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNTE0MzAwNQ== jhamman 2443309 2015-08-26T19:11:11Z 2015-08-26T19:11:11Z MEMBER

do we also need to check new_coord_names?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
135139591 https://github.com/pydata/xarray/pull/551#issuecomment-135139591 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNTEzOTU5MQ== shoyer 1217238 2015-08-26T18:58:49Z 2015-08-26T18:58:49Z MEMBER

I think you can put the Dataset checks in _update_vars_and_coords (on the keys of new_variables). That method gets called at the lowest level by everything that adds variables.

Note, for example, that you can also create new variables by passing a dictionary into Dataset.merge or Dataset.update.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
135112877 https://github.com/pydata/xarray/pull/551#issuecomment-135112877 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNTExMjg3Nw== jhamman 2443309 2015-08-26T17:19:59Z 2015-08-26T17:19:59Z MEMBER

82bcd8b follows the same rules as for the Dataset key names as the DataArray.name attribute.

c = xray.Dataset({'a': 1, ('b', 'b'): 2})

now raises a TypeError.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174
135099870 https://github.com/pydata/xarray/pull/551#issuecomment-135099870 https://api.github.com/repos/pydata/xarray/issues/551 MDEyOklzc3VlQ29tbWVudDEzNTA5OTg3MA== clarkfitzg 5356122 2015-08-26T16:37:59Z 2015-08-26T16:37:59Z MEMBER

Were you planning on also adding these checks to the keys of a Dataset in this PR? Because I believe you can still do this:

c = xray.Dataset({'a': a, ('b', 'b'): b})

and it won't raise an error.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  raise error if dataarray.name is wrong type 103055174

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