home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 778863478

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
778863478 MDU6SXNzdWU3Nzg4NjM0Nzg= 4765 Conversions to Pandas objects fail when mixtures of Index and MultiIndex are present 34008825 closed 0     3 2021-01-05T10:49:25Z 2021-06-26T18:24:46Z 2021-06-26T18:24:46Z NONE      

Hello Xarray team. Thank you very much for your efforts, they have made my job more pleasant.

What happened: When I try to convert a DataArray with a mix of MultiIndex and Index into any pandas object, it returns NotImplementedError: isna is not defined for MultiIndex.

What you expected to happen: If the DataArray contains all simple Index objects or one single MultiIndex, the transformation succeeds. I would expect the same from a mixture.

Minimal Complete Verifiable Example:

```python import numpy as np import pandas as pd import xarray as xr

da = xr.DataArray( np.random.randint(0, 10, size=[3, 3, 3]), coords={'x': ['x1', 'x2', 'x3'], 'y': ['y1', 'y2', 'y3'], 'z': ['z1', 'z2', 'z3']}, dims=['x', 'y', 'z'] )

da.to_series() # This works

da.stack(xyz=['x', 'y', 'z']).to_series() # This works

da.stack(xy=['x', 'y']).to_series() # This does not work ```

Anything else we need to know?: It happens the same thing with DataSet.

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 142 Stepping 12, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: None.None libhdf5: 1.10.4 libnetcdf: 4.7.3 xarray: 0.16.1 pandas: 1.1.3 numpy: 1.19.1 scipy: 1.5.2 netCDF4: 1.5.3 pydap: installed h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.3.0 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.30.0 distributed: 2.30.1 matplotlib: 3.3.3 cartopy: 0.18.0 seaborn: 0.11.0 numbagg: None pint: None setuptools: 50.3.0.post20201006 pip: 20.2.4 conda: 4.9.2 pytest: None IPython: 7.18.1 sphinx: 3.2.1
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4765/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

  • 1 row from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.726ms · About: xarray-datasette