home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where issue = 297560256 and user = 6815844 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • fujiisoup · 1 ✖

issue 1

  • cartesian product of coordinates and using it to index / fill empty dataset · 1 ✖

author_association 1

  • MEMBER 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
366825366 https://github.com/pydata/xarray/issues/1914#issuecomment-366825366 https://api.github.com/repos/pydata/xarray/issues/1914 MDEyOklzc3VlQ29tbWVudDM2NjgyNTM2Ng== fujiisoup 6815844 2018-02-19T23:21:05Z 2018-02-19T23:34:58Z MEMBER

I am not sure if it is efficient to interact with a cluster, but I often use MultiIndex for make a cartesian product, ```python In [1]: import xarray as xr ...: import numpy as np ...: data = xr.DataArray(np.full((3, 4), np.nan), dims=('x', 'y'), ...: coords={'x': [0, 1, 2], 'y': ['a', 'b', 'c', 'd']}) ...: ...: data ...: Out[1]: <xarray.DataArray (x: 3, y: 4)> array([[ nan, nan, nan, nan], [ nan, nan, nan, nan], [ nan, nan, nan, nan]]) Coordinates: * x (x) int64 0 1 2 * y (y) <U1 'a' 'b' 'c' 'd'

In [2]: data1 = data.stack(xy=['x', 'y']) ...: data1 ...: Out[2]: <xarray.DataArray (xy: 12)> array([ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan]) Coordinates: * xy (xy) MultiIndex - x (xy) int64 0 0 0 0 1 1 1 1 2 2 2 2 - y (xy) object 'a' 'b' 'c' 'd' 'a' 'b' 'c' 'd' 'a' 'b' 'c' 'd' For the above example, `data` becomes 1-dimensional with coordinate `xy`, where `xy` is a product of `x` and `y`. Each entry of `xy` is tuple of 'x' and 'y' value,python In [3]: data1[0] Out[3]: <xarray.DataArray ()> array(np.nan) Coordinates: xy object (0, 'a') and we can assign a value for given coordinate values by `loc` method,python In [5]: # Assuming we found the result with (1, 'a') is 2.0 ...: data1.loc[(1, 'a'), ] = 2.0

In [6]: data1 Out[6]: <xarray.DataArray (xy: 12)> array([ nan, nan, nan, nan, 2., nan, nan, nan, nan, nan, nan, nan]) Coordinates: * xy (xy) MultiIndex - x (xy) int64 0 0 0 0 1 1 1 1 2 2 2 2 - y (xy) object 'a' 'b' 'c' 'd' 'a' 'b' 'c' 'd' 'a' 'b' 'c' 'd' ```

Note that we need to access via data1.loc[(1, 'a'), ], rather than data1.loc[(1, 'a')] (last comma in the bracket is needed.)

EDIT: I modified my previous comment to take the partial assignment into accout.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  cartesian product of coordinates and using it to index / fill empty dataset 297560256

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