Note
Numpy (14) 본문
728x90
How to extract all numbers between a given range from a numpy array?
a = np.arange(15)
# 1
index = np.where((a >= 5) & (a <= 10))
a[index]
# 2
index = np.where(np.logical_and(a>=5, a<=10))
a[index]
# 3
a[(a >= 5) & (a <= 10)]
# output
(array([6, 9, 10]),)
'Numpy' 카테고리의 다른 글
Numpy (16) (0) | 2022.08.07 |
---|---|
Numpy (15) (0) | 2022.08.06 |
Numpy (13) (0) | 2022.08.03 |
Numpy (12) (0) | 2022.08.02 |
Numpy (11) (0) | 2022.07.31 |
Comments