issues: 596115014
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
596115014 | MDU6SXNzdWU1OTYxMTUwMTQ= | 3951 | series.to_xarray() fails when MultiIndex not sorted in xarray 0.15.1 | 3698640 | closed | 0 | 4 | 2020-04-07T19:56:26Z | 2020-04-08T02:19:11Z | 2020-04-08T02:19:11Z | CONTRIBUTOR | series.to_xarray() fails when MultiIndex not sorted in xarray 0.15.1 SummaryIt seems that Demonstrationxarray should be able to handle MultiIndices with unsorted dimensions. Using a fresh conda environment with xarray 0.14.1: ```python $ conda run -n py37xr14 python test.py
This fails in xarray 0.15.1 - note the data is not merely reordered - the data in column 'B' now has the incorrect values 4, 5, 6 rather than 1, 2, 3: ```python $ conda run -n py37xr15 python test.py
Test setup & environment infocontents of test.py```python import pandas as pd df = pd.DataFrame({'B': [1, 2, 3], 'A': [4, 5, 6]}) df = df.rename_axis('num').rename_axis('alpha', axis=1) print(">>> df") print(df) print("\n>>> df.stack('alpha')") print(df.stack('alpha')) print("\n>>> df.stack('alpha').to_xarray()") print(df.stack('alpha').to_xarray()) ```packages in py37xr14 environment```bash $ conda list -n py37xr14 # packages in environment at /Users/delgadom/miniconda3/envs/py37xr14: # # Name Version Build Channel ca-certificates 2020.4.5.1 hecc5488_0 conda-forge certifi 2020.4.5.1 py37hc8dfbb8_0 conda-forge libblas 3.8.0 16_openblas conda-forge libcblas 3.8.0 16_openblas conda-forge libcxx 9.0.1 2 conda-forge libffi 3.2.1 h4a8c4bd_1007 conda-forge libgfortran 4.0.0 2 conda-forge liblapack 3.8.0 16_openblas conda-forge libopenblas 0.3.9 h3d69b6c_0 conda-forge llvm-openmp 9.0.1 h28b9765_2 conda-forge ncurses 6.1 h0a44026_1002 conda-forge numpy 1.18.1 py37h7687784_1 conda-forge openssl 1.1.1f h0b31af3_0 conda-forge pandas 1.0.3 py37h94625e5_0 conda-forge pip 20.0.2 py_2 conda-forge python 3.7.6 h90870a6_5_cpython conda-forge python-dateutil 2.8.1 py_0 conda-forge python_abi 3.7 1_cp37m conda-forge pytz 2019.3 py_0 conda-forge readline 8.0 hcfe32e1_0 conda-forge setuptools 46.1.3 py37hc8dfbb8_0 conda-forge six 1.14.0 py_1 conda-forge sqlite 3.30.1 h93121df_0 conda-forge tk 8.6.10 hbbe82c9_0 conda-forge wheel 0.34.2 py_1 conda-forge xarray 0.14.1 py_1 conda-forge xz 5.2.5 h0b31af3_0 conda-forge zlib 1.2.11 h0b31af3_1006 conda-forge ```packages in py37xr15 environment```bash $ conda list -n py37xr15 # packages in environment at /Users/delgadom/miniconda3/envs/py37xr15: # # Name Version Build Channel ca-certificates 2020.4.5.1 hecc5488_0 conda-forge certifi 2020.4.5.1 py37hc8dfbb8_0 conda-forge libblas 3.8.0 16_openblas conda-forge libcblas 3.8.0 16_openblas conda-forge libcxx 9.0.1 2 conda-forge libffi 3.2.1 h4a8c4bd_1007 conda-forge libgfortran 4.0.0 2 conda-forge liblapack 3.8.0 16_openblas conda-forge libopenblas 0.3.9 h3d69b6c_0 conda-forge llvm-openmp 9.0.1 h28b9765_2 conda-forge ncurses 6.1 h0a44026_1002 conda-forge numpy 1.18.1 py37h7687784_1 conda-forge openssl 1.1.1f h0b31af3_0 conda-forge pandas 1.0.3 py37h94625e5_0 conda-forge pip 20.0.2 py_2 conda-forge python 3.7.6 h90870a6_5_cpython conda-forge python-dateutil 2.8.1 py_0 conda-forge python_abi 3.7 1_cp37m conda-forge pytz 2019.3 py_0 conda-forge readline 8.0 hcfe32e1_0 conda-forge setuptools 46.1.3 py37hc8dfbb8_0 conda-forge six 1.14.0 py_1 conda-forge sqlite 3.30.1 h93121df_0 conda-forge tk 8.6.10 hbbe82c9_0 conda-forge wheel 0.34.2 py_1 conda-forge xarray 0.15.1 py_0 conda-forge xz 5.2.5 h0b31af3_0 conda-forge zlib 1.2.11 h0b31af3_1006 conda-forge ``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3951/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |