Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMPAT: MultiIndex checking is fragile #1833

Closed
jreback opened this issue Jan 16, 2018 · 1 comment
Closed

COMPAT: MultiIndex checking is fragile #1833

jreback opened this issue Jan 16, 2018 · 1 comment

Comments

@jreback
Copy link

jreback commented Jan 16, 2018

https://github.com/pydata/xarray/blob/master/xarray/core/dataset.py#L2755

checking for a MI via

if hasattr(idx, 'levels'):
    # is a MI

should be changed to

if idx.nlevels > 1:
    # is a MI

see here. This is not currently implemented but good to get ahead of this hard to detect usage of the API.

@shoyer
Copy link
Member

shoyer commented Jan 17, 2018

Thanks for the heads up.

For our purposes, I think it would actually be just fine to use isinstance(idx, pd.MultiIndex) here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants