home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 193294569 and user = 6213168 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

  • crusaderky · 4 ✖

issue 1

  • Scalar coords vs. concat · 4 ✖

author_association 1

  • MEMBER 4
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
269600582 https://github.com/pydata/xarray/issues/1151#issuecomment-269600582 https://api.github.com/repos/pydata/xarray/issues/1151 MDEyOklzc3VlQ29tbWVudDI2OTYwMDU4Mg== crusaderky 6213168 2016-12-29T09:02:36Z 2016-12-29T09:05:48Z MEMBER

I just realised that xarray today already implements meaningful logic when concatenating between a and c in my example above - both on an existing dimension as well as on a new one. It's just a and b that don't work. I agree that defaulting to NaN would be a good option (regardless if the dimension is new or existing).

So to recap, when concatenating [a, b, c], where b does not have the y coord: - if the dtype of the y coord in both a and c is float, numpy.float32, or numpy.float64, fill in with NaN - if it's any datetime format, fill in with NaT - if it's strings, fill in with empty string?? - in any other case, convert everything to object and fill in with None

Correct? Is there any helper function to facilitate this?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Scalar coords vs. concat 193294569
269478770 https://github.com/pydata/xarray/issues/1151#issuecomment-269478770 https://api.github.com/repos/pydata/xarray/issues/1151 MDEyOklzc3VlQ29tbWVudDI2OTQ3ODc3MA== crusaderky 6213168 2016-12-28T13:43:55Z 2016-12-28T13:43:55Z MEMBER

@shoyer the end goal is to replicate in concat() the same behaviour you already hav in __add__ and __mul__. So take for example a = xarray.DataArray([1, 2, 3], dims=['x'], coords={'y': 10}) b = xarray.DataArray([4, 5, 6], dims=['x']) c = xarray.DataArray([7, 8, 9], dims=['x'], coords={'y': 20}) a+b -> y is propagated to the result (unambiguous) a+c -> y is discarded (ambiguous)

I suppose I could look at how this happens in __add__ and move the logic up into broadcast() (which __add__ should already invoke)?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Scalar coords vs. concat 193294569
269089778 https://github.com/pydata/xarray/issues/1151#issuecomment-269089778 https://api.github.com/repos/pydata/xarray/issues/1151 MDEyOklzc3VlQ29tbWVudDI2OTA4OTc3OA== crusaderky 6213168 2016-12-24T15:57:27Z 2016-12-24T15:57:27Z MEMBER

I updated the code and tested it in my project - it works fine. Any suggestions before I start integrating it inside xarray.broadcast()?

``` def broadcast_scalar_coords(*args, exclude=()): """Broadcast scalar coords whenever they're unambiguous, and remove them when they are ambiguous. This allows replicating the behaviour of addition or moltiplication of xarrays in concatenation. """ unambiguous = {} ambiguous = set() for arg in args: for k, v in arg.coords.items(): if k in exclude: continue # non-scalar coords are automatically ambiguous if v.shape == (): if k not in ambiguous: v = v.values.tolist() if unambiguous.get(k, v) != v: del unambiguous[k] ambiguous.add(k) else: unambiguous[k] = v else: ambiguous.add(k) unambiguous.pop(k, None)

args = tuple(arg.copy(deep=False) for arg in args)
for arg in args:
    for k, v in unambiguous.items():
        arg.coords[k] = v
    for k in ambiguous:
        if k in arg.coords and arg.coords[k].shape == ():
            del arg.coords[k]
return args

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Scalar coords vs. concat 193294569
264912356 https://github.com/pydata/xarray/issues/1151#issuecomment-264912356 https://api.github.com/repos/pydata/xarray/issues/1151 MDEyOklzc3VlQ29tbWVudDI2NDkxMjM1Ng== crusaderky 6213168 2016-12-05T17:05:34Z 2016-12-24T15:56:15Z MEMBER

I wrote down this. 1. should I simply add it to xarray.broadcast()? 2. can you spot any logical flaws? 3. suggestions for cleaner code? [edit] removed obsolete code

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Scalar coords vs. concat 193294569

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