LoginSignup
3
3

More than 5 years have passed since last update.

numpyのインデックス検索

Posted at

最小,最大のインデックス

  • np.argmin(max)を使う
import numpy as np
a = np.array([1,2,3,4,4])
np.argmin(a)

>>> 0
np.argmax(a)

>>> 3

重複すると小さい方が採用される.

条件付き検索

  • np.where(条件文)を使う
import numpy as np
a = np.array([1,2,3,4,4])
print np.where(a>2)

>>>(array([2, 3, 4]),)

参考

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3