home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 597475005 and user = 35968931 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

  • TomNicholas · 2 ✖

issue 1

  • Extending Xarray for domain-specific toolkits · 2 ✖

author_association 1

  • MEMBER 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
611967822 https://github.com/pydata/xarray/issues/3959#issuecomment-611967822 https://api.github.com/repos/pydata/xarray/issues/3959 MDEyOklzc3VlQ29tbWVudDYxMTk2NzgyMg== TomNicholas 35968931 2020-04-10T10:02:39Z 2020-04-10T10:02:39Z MEMBER

A docstring on a constructor is great -- is there a way to do something like that with accessors?

There surely must be some way to do that, but I'm afraid I'm not a docs wizard. However the accessor is still just a class, whose methods you want to document - would it be too unclear for them to hang off each HaploAccessor.specific_method()?

Is there a way to avoid running check_* methods multiple times?

There is some caching, but you shouldn't rely on it. In #3268 @crusaderky said "The more high level discussion is that the statefulness of the accessor is something that is OK to use for caching and performance improvements, and not OK for storing functional information like yours."

I think those checks could be expensive

those arrays should meet different dtype and dimensionality constraints

Checking dtype and dimensions shouldn't be expensive though, or is it more than that?

Well, we do actually have that problem in trying to find some way to represent 2-bit integers with sub-byte data types but I wasn't trying to get into that on this thread. I'll make the title better.

If you have other questions about dtypes in xarray then please feel free to raise another issue about that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Extending Xarray for domain-specific toolkits 597475005
611719548 https://github.com/pydata/xarray/issues/3959#issuecomment-611719548 https://api.github.com/repos/pydata/xarray/issues/3959 MDEyOklzc3VlQ29tbWVudDYxMTcxOTU0OA== TomNicholas 35968931 2020-04-09T19:46:50Z 2020-04-09T19:47:45Z MEMBER

All that said, is it still a bad idea to try to subclass Xarray data structures even if the intent was never to touch any part of the internal APIs?

One of the more immediate problems you'll find if you subclass is that xarray internally uses methods like self._construct_dataarray(dims, values, coords, attrs) to construct return values, so you will likely find that for a lot of methods you call you will only get back a bare DataArray, not the subclass you put in.

You could make custom accessors which perform checks on the input arrays when they get used? ```python @xr.register_dataset_accessor('haplo') def HaploDatasetAccessor: def init(self, ds) check_conforms_to_haplo_requirements(ds) self.data = ds

def analyse(self):
    ...

ds.haplo.analyse() ```

I'm also wondering whether given that the only real difference (not just by convention) of your desired data structures from xarray's is the dtype, then (if xarray actually offered it) would something akin to pandas' ExtensionDtype solve your problem?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Extending Xarray for domain-specific toolkits 597475005

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