home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where author_association = "MEMBER" and issue = 575564170 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

  • keewis 2
  • jhamman 1

issue 1

  • {DataArray,Dataset} accessors with parameters · 3 ✖

author_association 1

  • MEMBER · 3 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
597321847 https://github.com/pydata/xarray/issues/3829#issuecomment-597321847 https://api.github.com/repos/pydata/xarray/issues/3829 MDEyOklzc3VlQ29tbWVudDU5NzMyMTg0Nw== keewis 14808389 2020-03-10T21:16:20Z 2020-03-10T23:19:20Z MEMBER

:+1:

We might want to discourage using this to add methods to the DataArray / Dataset namespace, though.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  {DataArray,Dataset} accessors with parameters 575564170
597286480 https://github.com/pydata/xarray/issues/3829#issuecomment-597286480 https://api.github.com/repos/pydata/xarray/issues/3829 MDEyOklzc3VlQ29tbWVudDU5NzI4NjQ4MA== jhamman 2443309 2020-03-10T20:02:31Z 2020-03-10T20:02:31Z MEMBER

Would it be worth adding @keewis' examples to the accessor documentation?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  {DataArray,Dataset} accessors with parameters 575564170
594670062 https://github.com/pydata/xarray/issues/3829#issuecomment-594670062 https://api.github.com/repos/pydata/xarray/issues/3829 MDEyOklzc3VlQ29tbWVudDU5NDY3MDA2Mg== keewis 14808389 2020-03-04T17:10:59Z 2020-03-04T17:15:52Z MEMBER

not sure if you really should use accessors to do that; having a function return a wrapper object might be enough.

Then again, an accessor is a slightly modified version of a property so you can just make your object callable by defining __call__: ```python @xr.register_dataarray_accessor("weighted") class Weighted: def init(self, xarray_obj): self._obj = xarray_obj self._weight = None

def __call__(self, weight):
    self._weight = weight

def sum(self, dim):
    return "weighted sum"

this does allow calling `obj.weighted.sum(dim)`, so instead you can use:python In [2]: class Weighted: ...: def init(self, obj, weight): ...: self._obj = obj ...: self._weight = weight ...:
...: def sum(self, dim): ...: return f"weighted sum over {dim} and with weight {self._weight}" ...:
...: @xr.register_dataarray_accessor("weighted") ...: def weighted(obj): ...: def wrapped(weight): ...: return Weighted(obj, weight) ...: return wrapped ...:
...: da = xr.DataArray(data=range(5), dims="x") ...: da.weighted(5).sum(dim="x") Out[2]: 'weighted sum over x and with weight 5' ```

Edit: the warning about a overridden attribute was the result of rerunning the code without restarting the interpreter

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  {DataArray,Dataset} accessors with parameters 575564170

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