home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

2 rows where state = "closed", type = "issue" and user = 23738400 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
626063031 MDU6SXNzdWU2MjYwNjMwMzE= 4101 reset_index does not keep attributes OriolAbril 23738400 closed 0     1 2020-05-27T22:01:09Z 2020-06-05T19:39:10Z 2020-06-05T19:39:10Z CONTRIBUTOR      

If an indexing coordinate with attributes is converted to a non indexing coordinate with reset_index, the attributes are lost. I am not sure it is a bug, but I think they should keep the attributes and reset_coords does keep the attributes of reset coordinates.

MCVE Code Sample

```python temp = 15 + 8 * np.random.randn(2, 2, 3) time = xr.DataArray(pd.date_range('2014-09-06', periods=3), dims=["time"]).assign_attrs({"attr": 23}) coord = xr.DataArray([[-99.83, -99.32], [-99.79, -99.23]], dims=["x", "y"]).assign_attrs({"coord": True})

ds = xr.Dataset( { 'temperature': (['x', 'y', 'time'], temp), }, coords={ 'coord_0': coord, 'time': time, } ) ds

both coord_0 and time have attributes

ds.reset_index("time")

coordinate time_ does not have attributes anymore

ds.reset_coords("coord_0")

data variable coord_0 still has attributes

```

Expected Output

I would expect attributes to be kept.

Possible solution

I was wondering if changing this line and this other line to

vars_to_create[str(d) + "_"] = Variable(d, index, variables[d].attrs)

could solve this. If so I'll send a PR whenever I can.

Versions

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0] python-bits: 64 OS: Linux OS-release: 4.15.0-101-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.3 xarray: 0.15.1 pandas: 1.0.3 numpy: 1.18.4 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.2.1 cartopy: None seaborn: 0.10.1 numbagg: None setuptools: 42.0.2 pip: 20.1.1 conda: None pytest: 4.6.2 IPython: 7.14.0 sphinx: 2.0.0
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4101/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
462122623 MDU6SXNzdWU0NjIxMjI2MjM= 3056 Argument and its type joined in docs OriolAbril 23738400 closed 0     2 2019-06-28T16:48:27Z 2019-08-02T21:17:43Z 2019-08-02T21:17:43Z CONTRIBUTOR      

This issue has nearly no effect on users, but (at least for me) it is quite bothering aesthetically. It also looks like something simple to solve even though I am not an sphinx expert so I am not sure.

In the docstring, there is a colon between the name of one argument and its type, however, in the online documentation, the name and the type are smashed together. In the case of xr.align:

I think it would be more readable and appealing if there was some kind of separation between the two.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3056/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 879.364ms · About: xarray-datasette