Skip to content

flatten as convinience method for stack all? #1029

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

Closed
mathause opened this issue Oct 3, 2016 · 6 comments
Closed

flatten as convinience method for stack all? #1029

mathause opened this issue Oct 3, 2016 · 6 comments

Comments

@mathause
Copy link
Collaborator

mathause commented Oct 3, 2016

There is a bunch of operations that need to be conducted on a 1D array. It could be handy to have a convinience method that mimicks numpys flatten, i.e. works along the lines:

def flatten(dataarray, name='stacked'):
    return dataarray.stack(**{name: dataarray.dims})

What do you think?

@shoyer
Copy link
Member

shoyer commented Oct 3, 2016

Yes, seems like a great idea to me!

@feldman4
Copy link

feldman4 commented Dec 8, 2016

This is a good idea, any reason not to add linear indexing with array.flat[:] as well?

@stale
Copy link

stale bot commented Jan 24, 2019

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
If this issue remains relevant, please comment here; otherwise it will be marked as closed automatically

@stale stale bot added the stale label Jan 24, 2019
@shoyer
Copy link
Member

shoyer commented Jan 24, 2019

We might call this stack_all() instead -- that's closer to .stack() with alphabetical sorting.

@dcherian
Copy link
Contributor

Solved by .stack=[...]?

@mathause
Copy link
Collaborator Author

Yes indeed, good catch.

Closed by #3826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants