home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where issue = 1452123685 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 3

  • headtr1ck 4
  • keewis 1
  • templiert 1

author_association 3

  • COLLABORATOR 4
  • CONTRIBUTOR 1
  • MEMBER 1

issue 1

  • DataArray.transpose with transpose_coords=True does not change coords order · 6 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1326823221 https://github.com/pydata/xarray/issues/7294#issuecomment-1326823221 https://api.github.com/repos/pydata/xarray/issues/7294 IC_kwDOAMm_X85PFbc1 keewis 14808389 2022-11-24T20:39:03Z 2022-11-24T20:40:32Z MEMBER

transpose_coords is used to transpose coordinates with multiple dimensions: ```python In [1]: import xarray as xr ...: ...: ds = xr.tutorial.open_dataset("rasm") ...: ds.Tair.attrs.clear() ...: ds.Tair Out[1]: <xarray.DataArray 'Tair' (time: 36, y: 205, x: 275)> [2029500 values with dtype=float64] Coordinates: * time (time) object 1980-09-16 12:00:00 ... 1983-08-17 00:00:00 xc (y, x) float64 ... yc (y, x) float64 ... Dimensions without coordinates: y, x

In [2]: ds.Tair.transpose("x", "y", ..., transpose_coords=False) Out[2]: <xarray.DataArray 'Tair' (x: 275, y: 205, time: 36)> [2029500 values with dtype=float64] Coordinates: * time (time) object 1980-09-16 12:00:00 ... 1983-08-17 00:00:00 xc (y, x) float64 ... yc (y, x) float64 ... Dimensions without coordinates: x, y

In [3]: ds.Tair.transpose("x", "y", ..., transpose_coords=True) Out[3]: <xarray.DataArray 'Tair' (x: 275, y: 205, time: 36)> [2029500 values with dtype=float64] Coordinates: * time (time) object 1980-09-16 12:00:00 ... 1983-08-17 00:00:00 xc (x, y) float64 ... yc (x, y) float64 ... Dimensions without coordinates: x, y `` Interestingly,transpose_coordsis only an option forDataArray.transpose, and it defaults toTrue`. This means that the example from https://github.com/pydata/xarray/issues/7294#issue-1452123685 always does the same thing, so even if we did implement the reordering nothing would change.

As such, I'm -0.5 on changing the order in which the coordinates are stored, since the only time that order is used is the repr / HTML repr. In the past we have actually considered sorting the coordinates alphabetically, which did not happen because the coordinate names can be hashables of arbitrary types, and comparing a pair of hashables of different types is not easy.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DataArray.transpose with transpose_coords=True does not change coords order 1452123685
1326809036 https://github.com/pydata/xarray/issues/7294#issuecomment-1326809036 https://api.github.com/repos/pydata/xarray/issues/7294 IC_kwDOAMm_X85PFX_M headtr1ck 43316012 2022-11-24T20:07:47Z 2022-11-24T20:07:47Z COLLABORATOR

Just noticed that the same logic does not work for Datasets, since all variables are kept in a common dict and the information about which are coordinates and which are data-variables is kept in a set, which is not ordered...

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DataArray.transpose with transpose_coords=True does not change coords order 1452123685
1326804904 https://github.com/pydata/xarray/issues/7294#issuecomment-1326804904 https://api.github.com/repos/pydata/xarray/issues/7294 IC_kwDOAMm_X85PFW-o headtr1ck 43316012 2022-11-24T19:59:42Z 2022-11-24T19:59:42Z COLLABORATOR

The logic for this is not really trivial unless I am missing some obvious trick. You basically have to change the loop here: https://github.com/pydata/xarray/blob/ff6793d975ef4d1d8d5d32b8ad6f4f44e02dda9b/xarray/core/dataarray.py#L2919 To loop first over the new dims and potential coordinates with the same name and then over the rest of the coordinates (If possible in a single loop without code repetition).

Feel free to propose a PR!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DataArray.transpose with transpose_coords=True does not change coords order 1452123685
1325699317 https://github.com/pydata/xarray/issues/7294#issuecomment-1325699317 https://api.github.com/repos/pydata/xarray/issues/7294 IC_kwDOAMm_X85PBJD1 headtr1ck 43316012 2022-11-23T21:48:28Z 2022-11-23T21:48:28Z COLLABORATOR

And what should happen with non-dimension coordinates? Should they simply end up in the end?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DataArray.transpose with transpose_coords=True does not change coords order 1452123685
1317593352 https://github.com/pydata/xarray/issues/7294#issuecomment-1317593352 https://api.github.com/repos/pydata/xarray/issues/7294 IC_kwDOAMm_X85OiOEI templiert 34257249 2022-11-16T19:57:40Z 2022-11-16T19:57:40Z CONTRIBUTOR

Thanks. On one hand I see your point: a mapping does not ensure order. On the other hand, is it not counter-intuitive that the order of the dictionary-like container coords is not changed when using transpose_coords=True?

Here my reasoning: - dictionaries maintain insertion order - coords are a "Dictionary-like container" - a coords dict is created when transpose_coords==True - would it not be the right time, during insertion, to create the proper order?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DataArray.transpose with transpose_coords=True does not change coords order 1452123685
1317531894 https://github.com/pydata/xarray/issues/7294#issuecomment-1317531894 https://api.github.com/repos/pydata/xarray/issues/7294 IC_kwDOAMm_X85Oh_D2 headtr1ck 43316012 2022-11-16T19:07:00Z 2022-11-16T19:07:13Z COLLABORATOR

The coordinates are just a mapping from names to DataArrays, I don't think the order has any meaning (like it does for normal dicts).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DataArray.transpose with transpose_coords=True does not change coords order 1452123685

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