Skip to content

MultiIndex name (not 'names') is not set #4542

Closed
@max-sixty

Description

@max-sixty

Minimal Complete Verifiable Example:

In [82]: da = xr.DataArray(data, dims=list("ab")).stack(c=[...])

In [83]: data = np.random.RandomState(0).randn(1000, 500)

In [84]: da = xr.DataArray(data, dims=list("ab")).stack(c=[...])

In [85]: da.indexes['c']
Out[85]:
MultiIndex([(  0,   0),
            (  0,   1),
            (  0,   2),
            (  0,   3),
            (  0,   4),
            (  0,   5),
            (  0,   6),
            (  0,   7),
            (  0,   8),
            (  0,   9),
            ...
            (999, 490),
            (999, 491),
            (999, 492),
            (999, 493),
            (999, 494),
            (999, 495),
            (999, 496),
            (999, 497),
            (999, 498),
            (999, 499)],
           names=['a', 'b'], length=500000)

In [89]: da.indexes['c'].name

What you expected to happen:

In [89]: da.indexes['c'].name
Out [89]: 'c'

Environment:

Output of xr.show_versions()

In [90]: xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.8.6 (default, Oct 8 2020, 14:06:32)
[Clang 12.0.0 (clang-1200.0.32.2)]
python-bits: 64
OS: Darwin
OS-release: 19.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: None
libnetcdf: None

xarray: 0.16.1
pandas: 1.1.3
numpy: 1.19.2
scipy: 1.5.3
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.5.0
cftime: 1.2.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.30.0
distributed: None
matplotlib: 3.3.2
cartopy: None
seaborn: 0.11.0
numbagg: installed
pint: None
setuptools: 50.3.2
pip: 20.2.3
conda: None
pytest: 6.1.1
IPython: 7.18.1
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions