Merge pull request #70 from kuzand/kuzand-patch-1

Another solution to question 96
This commit is contained in:
Nicolas P. Rougier 2018-11-03 08:30:56 +01:00 committed by GitHub
commit a135916843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1156,6 +1156,11 @@ T = np.ascontiguousarray(Z).view(np.dtype((np.void, Z.dtype.itemsize * Z.shape[1
_, idx = np.unique(T, return_index=True)
uZ = Z[idx]
print(uZ)
# Author: Andreas Kouzelis
# NumPy >= 1.13
uZ = np.unique(Z, axis=0)
print(uZ)
```
#### 97. Considering 2 vectors A & B, write the einsum equivalent of inner, outer, sum, and mul function (★★★)

View File

@ -606,7 +606,7 @@ np.sqrt(-1) == np.emath.sqrt(-1)
#### 96. Given a two dimensional array, how to extract unique rows? (★★★)
(**hint**: np.ascontiguousarray)
(**hint**: np.ascontiguousarray | np.unique)