issues: 547091670
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
547091670 | MDU6SXNzdWU1NDcwOTE2NzA= | 3674 | Multi-index with categorical values | 31126826 | closed | 0 | 7 | 2020-01-08T20:43:04Z | 2020-03-13T19:55:07Z | 2020-03-13T19:55:07Z | CONTRIBUTOR | Building a dataset from pandas with a multi-index with categorical values: ```python import pandas as pd cat = pd.CategoricalDtype(categories=['foo', 'bar', 'baz']) i1 = pd.Series(['foo', 'bar'], dtype=cat) i2 = pd.Series(['bar', 'bar'], dtype=cat) df = pd.DataFrame({'i1': i1, 'i2': i2, 'values': [1, 2]}) ds = df.set_index(['i1', 'i2']).to_xarray() print(ds) ``` Expected output:
Actual output:
It is not wrong, but it is inconsistent with the non-categorical case (which gives the expected output above) and the single-index case (no filling with NaNs for single index). Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3674/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |