xarray icon indicating copy to clipboard operation
xarray copied to clipboard

Concat with multiindex

Open roberthannah89 opened this issue 2 years ago • 1 comments

What happened?

a = xr.concat([xr.DataArray(i) for i in [1,2,3]], pd.MultiIndex.from_tuples([('A', 'x'), ('B', 'y'), ('C', 'z')], names=['Group', 'Letter'])) xr.concat([a,a], 'D')

This should be fine but fails with

ValueError: cannot re-index or align objects with conflicting indexes found for the following dimensions: 'concat_dim' (2 conflicting indexes)

Conflicting indexes may occur when

  • they relate to different sets of coordinate and/or dimension names

  • they don't have the same type

  • they may be used to reindex data along common dimensions

What did you expect to happen?

No response

Minimal Complete Verifiable Example

No response

MVCE confirmation

  • [ ] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [ ] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [ ] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [ ] New issue — a search of GitHub Issues suggests this is not a duplicate.
  • [ ] Recent environment — the issue occurs with the latest version of xarray and its dependencies.

Relevant log output

No response

Anything else we need to know?

No response

Environment

roberthannah89 avatar Mar 05 '24 14:03 roberthannah89

Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!

welcome[bot] avatar Mar 05 '24 14:03 welcome[bot]