home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where issue = 514792972 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 6

  • dcherian 2
  • shoyer 1
  • kefirbandi 1
  • max-sixty 1
  • keewis 1
  • folmerkrikken 1

author_association 3

  • MEMBER 5
  • CONTRIBUTOR 1
  • NONE 1

issue 1

  • warn when updating coord.values : indexes are not updated · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
573971694 https://github.com/pydata/xarray/issues/3470#issuecomment-573971694 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU3Mzk3MTY5NA== keewis 14808389 2020-01-14T02:37:28Z 2020-01-14T02:37:28Z MEMBER

I might be wrong, but I think you should be able to implement this by overriding Variable.values.setter in IndexVariable, the same way it is done for Variable.data.setter.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972
573964243 https://github.com/pydata/xarray/issues/3470#issuecomment-573964243 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU3Mzk2NDI0Mw== dcherian 2448579 2020-01-14T02:06:30Z 2020-01-14T02:06:30Z MEMBER

I think what we probably want to do is mark variables used in indexes as having immutable data in xarray's data model, and raise an error for attempts to modify them in-place.

How do I implement this?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972
566214653 https://github.com/pydata/xarray/issues/3470#issuecomment-566214653 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU2NjIxNDY1Mw== shoyer 1217238 2019-12-16T19:48:38Z 2019-12-16T19:48:38Z MEMBER

The main problem is that when you write ds.time.values = something, you are modifying an attribute of a DataArray that happens to use the same variable as the as the Dataset, but otherwise the DataArray and Dataset are entirely independent. The DataArray does not have a reference to the original dataset, so it can't check or update the indexes.

This happened to work in previous versions of xarray, but only because indexes always mapped directly into the data of an xarray.Variable. But I don't think this is the right pattern to continue in the future, especially because we want to do define indexes over multiple variables (e.g., for MultiIndex).

I think what we probably want to do is mark variables used in indexes as having immutable data in xarray's data model, and raise an error for attempts to modify them in-place.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972
566208875 https://github.com/pydata/xarray/issues/3470#issuecomment-566208875 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU2NjIwODg3NQ== kefirbandi 1277781 2019-12-16T19:33:46Z 2019-12-16T19:33:46Z CONTRIBUTOR

Is it already decided what the resolution should be? * Giving a warning, as the title of this thread suggests? * Disable setting .values directly for dimensions? * Or making sure that .indexes are updated when .values are set directly

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972
548272942 https://github.com/pydata/xarray/issues/3470#issuecomment-548272942 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU0ODI3Mjk0Mg== folmerkrikken 35295222 2019-10-31T08:58:10Z 2019-10-31T08:58:10Z NONE

@dcherian Yes, ds.assign_coords does work and that's what I'm using now.

So can ds.assign_coords(..) be seen as the right way and changing the values inplace with ds.time.values = pd.... the wrong way? It all worked fine until changing from version 0.11.3 to 0.12.0.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972
547998577 https://github.com/pydata/xarray/issues/3470#issuecomment-547998577 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU0Nzk5ODU3Nw== max-sixty 5635139 2019-10-30T16:37:47Z 2019-10-30T16:37:47Z MEMBER

I've seen this type of code elsewhere: direct assignment to .values and .data of a coordinate variable which then leads to inconsistent objects and confusing behaviour. Is there something we can do to alert users?

Should we raise an error? Is there ever a use here? It might be messy to implement though; the ds.time would have to know it's a coord. Does the bigger index refactor help us at all here?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972
547995641 https://github.com/pydata/xarray/issues/3470#issuecomment-547995641 https://api.github.com/repos/pydata/xarray/issues/3470 MDEyOklzc3VlQ29tbWVudDU0Nzk5NTY0MQ== dcherian 2448579 2019-10-30T16:31:50Z 2019-10-30T16:31:50Z MEMBER

ds.time.values = pd.to_datetime(ds.time.values) + pd.DateOffset(months=2) By doing this, ds.indexes["time"] is not updated.

@folmerkrikken How about ds.assign_coords(time=pd.to_datetime(ds.time.values) + pd.DateOffset(months=2))

@shoyer I've seen this type of code elsewhere: direct assignment to .values and .data of a coordinate variable which then leads to inconsistent objects and confusing behaviour. Is there something we can do to alert users?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  warn when updating coord.values : indexes are not updated 514792972

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