home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 1358960570 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 3

  • mathause 2
  • JamiePringle 2
  • benbovy 1

author_association 2

  • MEMBER 3
  • NONE 2

issue 1

  • dataset.sel inconsistent results when argument is a list or a slice. · 5 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1235556683 https://github.com/pydata/xarray/issues/6976#issuecomment-1235556683 https://api.github.com/repos/pydata/xarray/issues/6976 IC_kwDOAMm_X85JpRlL JamiePringle 12818667 2022-09-02T14:13:27Z 2022-09-02T14:13:27Z NONE

I am happy to close this; it would be lovely if the documentation was more explicit about this issue. I was certainly surprised even after a close reading of the docs.

Jamie

On Fri, Sep 2, 2022 at 10:07 AM Mathias Hauser @.***> wrote:

CAUTION: This email originated from outside of the University System. Do not click links or open attachments unless you recognize the sender and know the content is safe.

CAUTION: This email originated from outside of the University System. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Jup, that's always the tradeoff - #1613 https://github.com/pydata/xarray/issues/1613 discusses a similar case.

— Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/issues/6976#issuecomment-1235549943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBZR25KUX6CEF5ESPUJLKLV4ICYRANCNFSM6AAAAAAQCNUNFM . You are receiving this because you authored the thread.Message ID: @.***>

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  dataset.sel inconsistent results when argument is a list or a slice. 1358960570
1235549943 https://github.com/pydata/xarray/issues/6976#issuecomment-1235549943 https://api.github.com/repos/pydata/xarray/issues/6976 IC_kwDOAMm_X85JpP73 mathause 10194086 2022-09-02T14:06:54Z 2022-09-02T14:06:54Z MEMBER

Jup, that's always the tradeoff - #1613 discusses a similar case.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  dataset.sel inconsistent results when argument is a list or a slice. 1358960570
1235533796 https://github.com/pydata/xarray/issues/6976#issuecomment-1235533796 https://api.github.com/repos/pydata/xarray/issues/6976 IC_kwDOAMm_X85JpL_k benbovy 4160723 2022-09-02T13:53:15Z 2022-09-02T13:53:15Z MEMBER

Xarray passes the label indexers to the underlying pandas index:

```python import pandas as pd

"x" coordinate index

idx = pd.Index([2, 1, 0, 3, 5])

da.sel(x=slice(2, 3)) does this:

idx.slice_indexer(2, 3)

which returns slice(0, 4, None)

da.sel(x=[2, 3]) does this:

idx.get_indexer([2, 3])

which returns array([0, 3])

```

What might be possible is to warn if selecting with a slice and the index is not monotonic increasing or decreasing.

Is it always desirable? Asked differently, are there cases where one intentionally wants to select with a slice a non monotonic index? If yes, a warning might be annoying.

Maybe this could be clarified in the docs too?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  dataset.sel inconsistent results when argument is a list or a slice. 1358960570
1234465676 https://github.com/pydata/xarray/issues/6976#issuecomment-1234465676 https://api.github.com/repos/pydata/xarray/issues/6976 IC_kwDOAMm_X85JlHOM JamiePringle 12818667 2022-09-01T15:47:43Z 2022-09-01T15:47:43Z NONE

So is this an expected behavior? I can work around it by explicitly creating the indices with arange() or the like. I do wonder if this is what is causing to_zarr() to fail even with compute=False? But I can work around that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  dataset.sel inconsistent results when argument is a list or a slice. 1358960570
1234453085 https://github.com/pydata/xarray/issues/6976#issuecomment-1234453085 https://api.github.com/repos/pydata/xarray/issues/6976 IC_kwDOAMm_X85JlEJd mathause 10194086 2022-09-01T15:37:25Z 2022-09-01T15:37:25Z MEMBER

A smaller repro:

```python import numpy as np import xarray as xr

xr.DataArray(np.arange(5), dims="x", coords={"x": [2, 1, 0, 3, 5]})

da.sel(x=slice(2, 3))

```

Returns: <xarray.DataArray (x: 4)> array([0, 1, 2, 3]) Coordinates: * x (x) int64 2 4 5 3

python da.sel(x=[2, 3]) Returns <xarray.DataArray (x: 2)> array([0, 3]) Coordinates: * x (x) int64 2 3


Yes, good point. What might be possible is to warn if selecting with a slice and the index is not monotonic increasing or decreasing.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  dataset.sel inconsistent results when argument is a list or a slice. 1358960570

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 1362.19ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows