[PYTHON] numpy index search

Minimum, maximum index

--Use np.argmin (max)

import numpy as np
a = np.array([1,2,3,4,4])
np.argmin(a)

>>> 0
np.argmax(a)

>>> 3

If they overlap, the smaller one is adopted.

Conditional search

--Use np.where (conditional statement)

import numpy as np
a = np.array([1,2,3,4,4])
print np.where(a>2)

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

reference

http://oppython.hatenablog.com/entry/2016/05/31/205746

Recommended Posts

numpy index search
[Python] Search (NumPy) ABC165C
numpy practice 1
Numpy [Basic]
django search
numpy part 1
NumPy basics
Numpy Memorandum_Matrix
numpy tips
About numpy
NumPy axis
Use Numpy
Django search
numpy part 2
[Python numpy] Dynamically specify the index of the array