回答編集履歴

1

コード修正

2019/02/05 08:56

投稿

can110
can110

スコア38266

test CHANGED
@@ -42,7 +42,13 @@
42
42
 
43
43
  print(a.shape) # (2268000,)
44
44
 
45
+ # 並びを維持したままダブりを消す
46
+
47
+ # https://stackoverflow.com/questions/15637336/numpy-unique-with-order-preserved
48
+
45
- a = np.unique(a) # ダブりを消す
49
+ _, idx = np.unique(a, return_index=True)
50
+
51
+ a = a[np.sort(idx)]
46
52
 
47
53
  print(a.shape) # (1138501,)
48
54