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 672842007,MDU6SXNzdWU2NzI4NDIwMDc=,4307,Cannot create Dataset from DataFrame containing CategoricalIndex with Intervals,55156127,open,0,,,2,2020-08-04T14:35:02Z,2022-04-17T18:08:10Z,,CONTRIBUTOR,,,," **What happened**: Creating a Dataset from a DataFrame with a CategoricalIndex (where the categories are an IntervalIndex) raises the error: ``` TypeError: data type not understood ``` **What you expected to happen**: I expected the output to be a Dataset object with the CategoricalIndex as one of the coordinates. **Minimal Complete Verifiable Example**: ```python import pandas as pd import xarray as xr df = pd.DataFrame({""name"": list(""abcdefghijk""), ""age"": range(11)}) df[""age_group""] = pd.cut(df[""age""], bins=5) df = df.set_index([""name"", ""age_group""]) df.to_xarray() # or xr.Dataset.from_dataframe(df) ``` **Environment**:
Output of xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.7.5 (default, Oct 25 2019, 10:52:18) [Clang 4.0.1 (tags/RELEASE_401/final)] python-bits: 64 OS: Darwin OS-release: 19.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: None.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.1 xarray: 0.15.1 pandas: 1.0.3 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.4.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.1.3 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.0 cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.1.3 cartopy: None seaborn: 0.9.0 numbagg: None setuptools: 46.4.0.post20200518 pip: 20.0.2 conda: 4.8.3 pytest: None IPython: 7.13.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4307/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 672873111,MDExOlB1bGxSZXF1ZXN0NDYyODMzNzk3,4308,Fix typo,55156127,closed,0,,,1,2020-08-04T15:16:52Z,2020-08-04T16:21:27Z,2020-08-04T16:21:27Z,CONTRIBUTOR,,0,pydata/xarray/pulls/4308," ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4308/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull