Note
Numpy (46) 본문
728x90
How to find the position of the first occurrence of a value greater than a given value?
# Input:
url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'
iris = np.genfromtxt(url, delimiter=',', dtype='object')
# Solution: (edit: changed argmax to argwhere. Thanks Rong!)
np.argwhere(iris[:, 3].astype(float) > 1.0)[0]
# output
50
'Numpy' 카테고리의 다른 글
Numpy (48) (0) | 2022.09.14 |
---|---|
Numpy (47) (0) | 2022.09.13 |
Numpy (45) (0) | 2022.09.11 |
Numpy (44) (0) | 2022.09.10 |
Numpy (43) (0) | 2022.09.07 |
Comments