Skip to content

flatten as convinience method for stack all? #1029

Closed

Description

@mathause

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?

Activity

  1. shoyer commented on Oct 3, 2016

    @shoyer
    Member

    Yes, seems like a great idea to me!

  2. feldman4 commented on Dec 8, 2016

    @feldman4

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

  3. stale commented on Jan 24, 2019

    @stale

    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

  4. shoyer commented on Jan 24, 2019

    @shoyer
    Member

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

  5. dcherian commented on Mar 25, 2020

    @dcherian
    Contributor

    Solved by .stack=[...]?

  6. mathause commented on Mar 25, 2020

    @mathause
    CollaboratorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions