Skip to content

MultiIndex coordinates loc/sel not working in 0.19.0 #5691

Closed
@genric

Description

@genric

What happened:

TypeError: unhashable type: 'numpy.ndarray'

What you expected to happen:
No error

Minimal Complete Verifiable Example:
Take this for example:

import numpy as np
import pandas as pd
import xarray as xr
midx = pd.MultiIndex.from_arrays([["R", "R", "V", "V"], [0.1, 0.2, 0.7, 0.9]], names=("band", "wn"))
mda = xr.DataArray(np.random.rand(4), coords={"spec": midx}, dims="spec")
mda.loc[{'band': 'R', 'wn': 0.1}]

Environment:

xarray: 0.19.0, pandas: 1.3.1, numpy: 1.21.1,

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