home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 316726712

This data as json

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
316726712 MDU6SXNzdWUzMTY3MjY3MTI= 2076 Get sub level names from multiindex 4180033 closed 0     2 2018-04-23T09:14:30Z 2018-05-18T05:13:38Z 2018-05-18T05:13:38Z NONE      

Hi, is there any method / attribute to get the sub level names from a MultiIndex?

python ds = xr.Dataset({ "lat": np.arange(100), "lon": np.arange(100), }) ds.stack(main=("lat", "lon"))

<xarray.Dataset> Dimensions: (main: 10000) Coordinates: * main (main) MultiIndex - lat (main) int64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... - lon (main) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ... Data variables: *empty*

I would like to have the names lat and lon as a list (let's assume I did not know that they were stacked together). They should be stored internally, right? I even went through the formatting module to search for the correct attribute but I could not find it.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.5.final.0 python-bits: 64 OS: Linux OS-release: 3.16.0-4-amd64 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.utf8 LOCALE: en_US.UTF-8 xarray: 0.10.3 pandas: 0.22.0 numpy: 1.14.2 scipy: 1.0.1 netCDF4: 1.3.1 h5netcdf: 0.5.0 h5py: 2.7.1 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.2 distributed: 1.21.6 matplotlib: 2.2.2 cartopy: 0.16.0 seaborn: 0.8.1 setuptools: 39.0.1 pip: 9.0.3 conda: None pytest: 3.5.0 IPython: 6.3.1 sphinx: 1.7.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2076/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.598ms · About: xarray-datasette