Note
Numpy (57) 본문
728x90
How to compute the min-by-max for each row for a numpy array 2d?
# Input
np.random.seed(100)
a = np.random.randint(1,10, [5,3])
a
# Solution
np.apply_along_axis(lambda x: np.min(x)/np.max(x), arr=a, axis=1)
# output
array([ 0.44444444, 0.125 , 0.5 , 1. , 0.11111111])
'Numpy' 카테고리의 다른 글
Numpy (56) (0) | 2022.10.18 |
---|---|
Numpy (55) (0) | 2022.10.14 |
Numpy (54) (0) | 2022.10.13 |
Numpy (53) (0) | 2022.09.21 |
Numpy (52) (0) | 2022.09.20 |
Comments