home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

2 rows where "created_at" is on date 2022-05-01, type = "issue" and user = 43316012 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 1

  • issue · 2 ✖

state 1

  • closed 2

repo 1

  • xarray 2
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1222103599 I_kwDOAMm_X85I19Iv 6554 isel with drop=True does not drop coordinates if using scalar DataArray as indexer headtr1ck 43316012 closed 0     2 2022-05-01T10:14:37Z 2022-05-10T06:18:19Z 2022-05-10T06:18:19Z COLLABORATOR      

What happened?

When using DataArray/Dataset.isel with drop=True with a scalar DataArray as indexer (see example) resulting scalar coordinates do not get dropped. When using an integer the behavior is as expected.

What did you expect to happen?

I expect that using a scalar DataArray behaves the same as an integer.

Minimal Complete Verifiable Example

```Python import xarray as xr

da = xr.DataArray([1, 2, 3], dims="x", coord={"k": ("x", [0, 1, 2])})

<xarray.DataArray (x: 3)>

array([1, 2, 3])

Coordinates:

k (x) int32 0 1 2

da.isel({"x": 1}, drop=True)

works

<xarray.DataArray ()>

array(2)

da.isel({"x": xr.DataArray(1)}, drop=True)

does not drop "k" coordinate

<xarray.DataArray ()>

array(2)

Coordinates:

k int32 1

```

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS ------------------ commit: 4fbca23a9fd8458ec8f917dd0e54656925503e90 python: 3.9.6 | packaged by conda-forge | (default, Jul 6 2021, 08:46:02) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('de_DE', 'cp1252') libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.18.2.dev76+g3a7e7ca2.d20210706 pandas: 1.3.0 numpy: 1.21.0 scipy: 1.7.0 netCDF4: 1.5.6 pydap: installed h5netcdf: 0.11.0 h5py: 3.3.0 Nio: None zarr: 2.8.3 cftime: 1.5.0 nc_time_axis: 1.3.1 PseudoNetCDF: installed cfgrib: None iris: 2.4.0 bottleneck: 1.3.2 dask: 2021.06.2 distributed: 2021.06.2 matplotlib: 3.4.2 cartopy: 0.19.0.post1 seaborn: 0.11.1 numbagg: 0.2.1 fsspec: 2021.06.1 cupy: None pint: 0.17 sparse: 0.12.0 setuptools: 49.6.0.post20210108 pip: 21.3.1 conda: None pytest: 6.2.4 IPython: None sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6554/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1222215528 I_kwDOAMm_X85I2Ydo 6555 sortby with ascending=False should create an index headtr1ck 43316012 closed 0     4 2022-05-01T16:57:51Z 2022-05-01T22:17:50Z 2022-05-01T22:17:50Z COLLABORATOR      

Is your feature request related to a problem?

When using sortby with ascending=False on a DataArray/Dataset without an explicit index, the data gets correctly reversed, but it is not possible to tell anymore which ordering the data has.

If an explicit index (like [0, 1, 2]) exists, it gets correctly reordered and allowes correct aligning.

Describe the solution you'd like

For consistency with aligning xarray should create a new index that indicates that the data has been reordered, i.e. [2, 1, 0].

Only downside: this will break code that relies on non-existent indexes.

Describe alternatives you've considered

No response

Additional context

No response

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6555/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 27.935ms · About: xarray-datasette