home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 789106802 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 4

  • max-sixty 2
  • dcherian 1
  • benbovy 1
  • keewis 1

issue 1

  • clean up the API for renaming and changing dimensions / coordinates · 5 ✖

author_association 1

  • MEMBER 5
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
916974087 https://github.com/pydata/xarray/issues/4825#issuecomment-916974087 https://api.github.com/repos/pydata/xarray/issues/4825 IC_kwDOAMm_X842p-oH benbovy 4160723 2021-09-10T15:04:14Z 2021-09-10T15:04:14Z MEMBER

I think that the explicit index refactoring would be an opportunity to clarify things a bit. With no concept of a dimension coordinate/ implicit index, ideally we could have the following behavior with a clear distinction between dimensions/coordinates and indexes, following more closely the "explicit is better than implicit" principle:

  • set_index / reset_index would only affect the indexes without implicitly renaming any coordinate or dimension.
  • actually, setting a new index for a given dimension doesn't make much sense anymore with the new data model. Setting a new index for a given set of variables and/or coordinates makes more sense
  • trying to set an index from non-existing data variables or coordinates would raise a KeyError
  • .reset_index("x") would not rename the x coordinate to x_
  • .set_index(x="b") (where x is a dimension without index/coordinate and b is a variable with dimension x) would be replaced by a more explicit set_index("b").rename({"b": "x"}). Renaming b to x wouldn't even be necessary if we want to use the b coordinate as an index.

  • rename_* would only affect the name of coordinates or dimensions (or the name of the DataArray) without implicitly adding or removing any index.

  • .set_coords("b").rename({"b": "x"}) in the example above would not implictly create an index for the "x" coordinate

  • swap_dims would only affect the existing dimension names without implicitly adding or removing any index and without renaming any coordinate.

This would be in an ideal world, though. More practically, I don't know how we could make a smooth transition.

There's also rename_dims, but only on a Dataset! There's a TODO to deprecate swap_dims in favor of that. Though I'm not sure that's right — swap_dims changes the dim values for another variable's, but rename_dims just changes the name?

swap_dims used as a workaround for switching from one to another coordinate as index on a dimension will no longer be needed after the explicit indexes refactoring. Should we eventually depreciate it, then?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  clean up the API for renaming and changing dimensions / coordinates 789106802
766933711 https://github.com/pydata/xarray/issues/4825#issuecomment-766933711 https://api.github.com/repos/pydata/xarray/issues/4825 MDEyOklzc3VlQ29tbWVudDc2NjkzMzcxMQ== keewis 14808389 2021-01-25T16:21:54Z 2021-01-25T16:21:54Z MEMBER

if we do 2 I think we should add a new_dims kwarg to reset_index, otherwise swapping to a dimension without a coordinate is a lot more difficult.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  clean up the API for renaming and changing dimensions / coordinates 789106802
766914263 https://github.com/pydata/xarray/issues/4825#issuecomment-766914263 https://api.github.com/repos/pydata/xarray/issues/4825 MDEyOklzc3VlQ29tbWVudDc2NjkxNDI2Mw== dcherian 2448579 2021-01-25T15:54:14Z 2021-01-25T15:54:14Z MEMBER

I'm not sure exactly how to rationalize them though.

How about

  1. rename_* should only allow renaming to unused names,
  2. swap_dims should only work with existing names.
  3. set_index should raise an error for the "renaming" and "swapping" cases.
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  clean up the API for renaming and changing dimensions / coordinates 789106802
766429379 https://github.com/pydata/xarray/issues/4825#issuecomment-766429379 https://api.github.com/repos/pydata/xarray/issues/4825 MDEyOklzc3VlQ29tbWVudDc2NjQyOTM3OQ== max-sixty 5635139 2021-01-24T20:48:19Z 2021-01-24T20:48:19Z MEMBER

There's also rename_dims, but only on a Dataset! There's a TODO to deprecate swap_dims in favor of that. Though I'm not sure that's right — swap_dims changes the dim values for another variable's, but rename_dims just changes the name?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  clean up the API for renaming and changing dimensions / coordinates 789106802
763219168 https://github.com/pydata/xarray/issues/4825#issuecomment-763219168 https://api.github.com/repos/pydata/xarray/issues/4825 MDEyOklzc3VlQ29tbWVudDc2MzIxOTE2OA== max-sixty 5635139 2021-01-19T23:53:34Z 2021-01-19T23:53:34Z MEMBER

I agree it's confusing, and I find myself looking up the correct way to do something fairly frequently.

I'm not sure exactly how to rationalize them though.

Without thinking this through in enough detail, Does set_ set the variable to the relevant type and reset_ unsets it to a normal variable? In that framework, I think the only aberrant is swap_dims, which could instead be set_dims?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  clean up the API for renaming and changing dimensions / coordinates 789106802

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