home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

11 rows where author_association = "CONTRIBUTOR" and issue = 877016428 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

  • znicholls 10
  • github-actions[bot] 1

issue 1

  • Numpy string coding · 11 ✖

author_association 1

  • CONTRIBUTOR · 11 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
879523246 https://github.com/pydata/xarray/pull/5264#issuecomment-879523246 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDg3OTUyMzI0Ng== github-actions[bot] 41898282 2021-07-14T01:52:10Z 2021-10-02T08:45:41Z CONTRIBUTOR

Unit Test Results

6 files           6 suites   55m 20s :stopwatch: 16 230 tests 14 495 :heavy_check_mark: 1 735 :zzz: 0 :x: 90 576 runs  82 392 :heavy_check_mark: 8 184 :zzz: 0 :x:

Results for commit fc8252e8.

:recycle: This comment has been updated with latest results.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
931822464 https://github.com/pydata/xarray/pull/5264#issuecomment-931822464 https://api.github.com/repos/pydata/xarray/issues/5264 IC_kwDOAMm_X843inuA znicholls 23625371 2021-10-01T01:27:24Z 2021-10-01T01:27:24Z CONTRIBUTOR

@lewisjarednz fyi

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
931822417 https://github.com/pydata/xarray/pull/5264#issuecomment-931822417 https://api.github.com/repos/pydata/xarray/issues/5264 IC_kwDOAMm_X843intR znicholls 23625371 2021-10-01T01:27:15Z 2021-10-01T01:27:15Z CONTRIBUTOR

@shoyer can I bother you again now that CI is passing please?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
882924370 https://github.com/pydata/xarray/pull/5264#issuecomment-882924370 https://api.github.com/repos/pydata/xarray/issues/5264 IC_kwDOAMm_X840oFtS znicholls 23625371 2021-07-19T23:19:01Z 2021-07-19T23:19:01Z CONTRIBUTOR

Ignoring failing CI due to fsspec (see https://github.com/pydata/xarray/pull/5615#issuecomment-881679900)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
879538970 https://github.com/pydata/xarray/pull/5264#issuecomment-879538970 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDg3OTUzODk3MA== znicholls 23625371 2021-07-14T02:35:18Z 2021-07-14T02:35:18Z CONTRIBUTOR

xarray/tests/test_backends.py::test_open_fsspec appears to fail because of the release of ffspec 2021.7.0 so this PR will probably have to wait until a fix for that is added (presumably elsewhere to keep the changes clear).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
879533808 https://github.com/pydata/xarray/pull/5264#issuecomment-879533808 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDg3OTUzMzgwOA== znicholls 23625371 2021-07-14T02:19:55Z 2021-07-14T02:20:27Z CONTRIBUTOR

Something like 59ed7d5? (Obviously missing proper tests but just to get a sense of whether the idea is plausible)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
879517988 https://github.com/pydata/xarray/pull/5264#issuecomment-879517988 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDg3OTUxNzk4OA== znicholls 23625371 2021-07-14T01:41:38Z 2021-07-14T01:41:38Z CONTRIBUTOR

I tried pushing a fix. It's unclear to me whether the change should be in how the dtypes are inferred (given that the inference code seems to do what it is meant to...) or whether is_unicode_dtype simply needs to be updated to know about np.str_ (which is the fix I just tried).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
833233473 https://github.com/pydata/xarray/pull/5264#issuecomment-833233473 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDgzMzIzMzQ3Mw== znicholls 23625371 2021-05-06T05:21:19Z 2021-07-14T01:08:18Z CONTRIBUTOR

What problem are you trying to solve here?

Somehow I ended up with np.str_ in a pandas dataframe (how is unclear to me but this seems to be a valid string type), which then exploded when I converted to xarray and attempted to save as netCDF. Minimal example below.

```python import numpy as np import pandas as pd

I don't know how the strings ended up being np.str_....

scenarios = [np.str_(v) for v in ["scenario_a", "scenario_b", "scenario_c"]] years = range(2015, 2100 + 1) tdf = pd.DataFrame( data=np.random.random((len(scenarios), len(years))), columns=years, index=scenarios, ) tdf.index.name = "scenario" tdf.columns.name = "year" tdf = tdf.stack() tdf.name = "tas"

txr = tdf.to_xarray()

raises error shown below

txr.to_netcdf("test.nc")

error

Traceback (most recent call last): File "scratch.py", line 20, in <module> txr.to_netcdf("test.nc") File ".../lib/python3.7/site-packages/xarray/core/dataarray.py", line 2741, in to_netcdf return dataset.to_netcdf(args, *kwargs) File ".../lib/python3.7/site-packages/xarray/core/dataset.py", line 1699, in to_netcdf invalid_netcdf=invalid_netcdf, File ".../lib/python3.7/site-packages/xarray/backends/api.py", line 1108, in to_netcdf dataset, store, writer, encoding=encoding, unlimited_dims=unlimited_dims File ".../lib/python3.7/site-packages/xarray/backends/api.py", line 1154, in dump_to_store store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) File ".../lib/python3.7/site-packages/xarray/backends/common.py", line 256, in store variables, check_encoding_set, writer, unlimited_dims=unlimited_dims File ".../lib/python3.7/site-packages/xarray/backends/common.py", line 294, in set_variables name, v, check, unlimited_dims=unlimited_dims File ".../lib/python3.7/site-packages/xarray/backends/netCDF4_.py", line 464, in prepare_variable variable, self.format, raise_on_invalid_encoding=check_encoding File ".../lib/python3.7/site-packages/xarray/backends/netCDF4_.py", line 131, in get_datatype datatype = _nc4_dtype(var) File ".../lib/python3.7/site-packages/xarray/backends/netCDF4.py", line 154, in _nc4_dtype raise ValueError(f"unsupported dtype for netCDF4 variable: {var.dtype}") ValueError: unsupported dtype for netCDF4 variable: object ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
848597492 https://github.com/pydata/xarray/pull/5264#issuecomment-848597492 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDg0ODU5NzQ5Mg== znicholls 23625371 2021-05-26T08:58:23Z 2021-05-26T08:58:23Z CONTRIBUTOR

I agree, this should totally work. It's not obvious to me how to best fix it, though.

I assume it's not as trivial as just changing e.g. https://github.com/pydata/xarray/blob/f9a535c130615fe81379d785dffcc6c814fc1126/xarray/coding/strings.py#L32 to also know about np.str_?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
848517059 https://github.com/pydata/xarray/pull/5264#issuecomment-848517059 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDg0ODUxNzA1OQ== znicholls 23625371 2021-05-26T06:55:48Z 2021-05-26T06:55:48Z CONTRIBUTOR

@shoyer any further thoughts on this now that the scope is clearer?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428
833182029 https://github.com/pydata/xarray/pull/5264#issuecomment-833182029 https://api.github.com/repos/pydata/xarray/issues/5264 MDEyOklzc3VlQ29tbWVudDgzMzE4MjAyOQ== znicholls 23625371 2021-05-06T02:37:57Z 2021-05-06T02:37:57Z CONTRIBUTOR

So far I've just added a single test which fails. I don't think the test should fail although I'm not sure what the np.str_ type actually is so maybe this isn't a bug? Help/advice greatly appreciated.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Numpy string coding 877016428

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