Skip to content

Add utility function to efficiently unstack xarrays - #757

Open
takluyver wants to merge 4 commits into
masterfrom
feat/unstack-regular
Open

Add utility function to efficiently unstack xarrays#757
takluyver wants to merge 4 commits into
masterfrom
feat/unstack-regular

Conversation

@takluyver

@takluyver takluyver commented Jul 27, 2026

Copy link
Copy Markdown
Member

unstack_regular() aims to solve 3 pain points of DataArray.unstack():

  1. The data is copied to a new array, even when it could make a view, which is slow and needs extra memory.
  2. Integer data can be unexpectedly converted to floats to allow NaN as a fill value.
  3. The unstacked dimensions are placed at the end of the axis order, instead of where the original stacked dimension was.

Points 1 & 3 may be addressed in xarray at some point.

@takluyver
takluyver force-pushed the feat/unstack-regular branch from a36547f to 841ecdd Compare July 27, 2026 17:06
@takluyver
takluyver marked this pull request as ready for review July 28, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant