8000 Add unique row, for finding unique rows in a 2D array · Issue #2871 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
Add unique row, for finding unique rows in a 2D array #2871
Closed
@simon-r

Description

@simon-r

In matlab the function unique works also for selecting the unique rows.
That should be useful if you add this possibility also in numpy.

For example:

a = np.array( [ [1,2][2,3][1,2] ] )

np.unique(a , row=True ) # for example
[[1,2]
[2,3]]

see matlab docs: http://www.mathworks.com/help/matlab/ref/unique.html

Now in numpy for performing this operation we must use some unreadable code like:

np.unique1d(c.view([('',c.dtype)]*c.shape[1])).view(c.dtype).reshape(-1,c.shape[1])

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

      0