teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

コード修正

2019/02/05 08:56

投稿

8524ba23
8524ba23

スコア38352

answer CHANGED
@@ -20,7 +20,10 @@
20
20
  a[(i+1)*L:(i+2)*L] = df2['C'].values
21
21
 
22
22
  print(a.shape) # (2268000,)
23
+ # 並びを維持したままダブりを消す
24
+ # https://stackoverflow.com/questions/15637336/numpy-unique-with-order-preserved
23
- a = np.unique(a) # ダブりを消す
25
+ _, idx = np.unique(a, return_index=True)
26
+ a = a[np.sort(idx)]
24
27
  print(a.shape) # (1138501,)
25
28
  # a = a.reshape(M,L*2) # ダブりを消すとこのカタチにならないのでは?
26
29
  ```