Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ellipsis to be used in stack #3826

Merged
merged 12 commits into from
Mar 19, 2020
Merged

Conversation

max-sixty
Copy link
Collaborator

@max-sixty max-sixty commented Mar 4, 2020

  • Closes Allow an ellipsis in stack? #3814
  • Tests added
  • Passes isort -rc . && black . && mypy . && flake8
  • Fully documented, including whats-new.rst for all changes and api.rst for new API

Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @max-sixty. That was quick!

LGTM. We should add a sentence to the docstrings.

@max-sixty
Copy link
Collaborator Author

Should we support

  • .stack(x=[...])
  • .stack(x=...)
  • both

Currently implemented for both but leaning towards the first, partly because it makes the typing correct

@max-sixty
Copy link
Collaborator Author

Changed to supporting the first (.stack(x=[...])) only

@shoyer
Copy link
Member

shoyer commented Mar 6, 2020

This is very cool!

It seems like it would be natural to support a combination of ellipsis and some explicit dimensions, like what can be done in transpose? E.g., .stack(x=[‘y’, ...]) or .stack(x=[..., ‘y’])?

@max-sixty
Copy link
Collaborator Author

It seems like it would be natural to support a combination of ellipsis and some explicit dimensions, like what can be done in transpose? E.g., .stack(x=[‘y’, ...]) or .stack(x=[..., ‘y’])?

Yes great!

@max-sixty
Copy link
Collaborator Author

Updated!

xarray/core/dataarray.py Outdated Show resolved Hide resolved
This was referenced Mar 16, 2020
@dcherian
Copy link
Contributor

Thanks @max-sixty

@dcherian dcherian merged commit e8a284f into pydata:master Mar 19, 2020
@max-sixty max-sixty deleted the stack-ellipsis branch March 20, 2020 01:20
dcherian added a commit to dcherian/xarray that referenced this pull request Mar 22, 2020
* upstream/master:
  add spacing in the versions section of the issue report (pydata#3876)
  map_blocks: allow user function to add new unindexed dimension. (pydata#3817)
  Delete associated indexes when deleting coordinate variables. (pydata#3840)
  remove macos build while waiting for libwebp fix (pydata#3875)
  Fix html repr on non-str keys (pydata#3870)
  Allow ellipsis to be used in stack (pydata#3826)
  Improve where docstring (pydata#3836)
  Add DataArray.pad, Dataset.pad, Variable.pad (pydata#3596)
  Fix some warnings (pydata#3864)
  Feature/weighted (pydata#2922)
  Fix recombination in groupby when changing size along the grouped dimension (pydata#3807)
  Blacken the doctest code in docstrings (pydata#3857)
  Fix multi-index with categorical values. (pydata#3860)
  Fix interp bug when indexer shares coordinates with array (pydata#3758)
  Fix alignment with join="override" when some dims are unindexed (pydata#3839)
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.

3 participants