Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efa490b

Browse files
committed
First master exercise
1 parent 020bd2b commit efa490b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,19 @@ Master
563563
======
564564
565565
566+
1. Given a two dimensional array, how to extract unique rows ?
567+
568+
.. code:: python
569+
570+
# Jaime Fernández del Río
571+
572+
Z = np.random.randint(0,2,(6,6))
573+
T = np.ascontiguousarray(Z).view(np.dtype((np.void, Z.dtype.itemsize * Z.shape[1])))
574+
_, idx = np.unique(T, return_index=True)
575+
uZ = Z[idx]
576+
577+
.. note:: See `stackoverflow <http://stackoverflow.com/questions/16970982/find-unique-rows-in-numpy-array/>`_ for explanations.
578+
566579
567580
Archmaster
568581
==========

0 commit comments

Comments
 (0)