Skip to content

Commit a135916

Browse files
authored
Merge pull request rougier#70 from kuzand/kuzand-patch-1
Another solution to question 96
2 parents e163a64 + 03b1a40 commit a135916

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

100_Numpy_exercises.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,11 @@ T = np.ascontiguousarray(Z).view(np.dtype((np.void, Z.dtype.itemsize * Z.shape[1
11561156
_, idx = np.unique(T, return_index=True)
11571157
uZ = Z[idx]
11581158
print(uZ)
1159+
1160+
# Author: Andreas Kouzelis
1161+
# NumPy >= 1.13
1162+
uZ = np.unique(Z, axis=0)
1163+
print(uZ)
11591164
```
11601165

11611166
#### 97. Considering 2 vectors A & B, write the einsum equivalent of inner, outer, sum, and mul function (★★★)

100_Numpy_exercises_with_hint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ np.sqrt(-1) == np.emath.sqrt(-1)
606606

607607
#### 96. Given a two dimensional array, how to extract unique rows? (★★★)
608608

609-
(**hint**: np.ascontiguousarray)
609+
(**hint**: np.ascontiguousarray | np.unique)
610610

611611

612612

0 commit comments

Comments
 (0)