Numpy Memo

たまにしか使わないと毎回忘れるのでメモ。

index


= = = = = = = = = = = = = = =

np.amin()

deepage.net


import numpy as np


a = [
    [0, 1, 2, 3],
    [10, 11, 12, 13]
]


print(np.amin(a))
"""
0
"""


print(np.amin(a, axis=0))
"""
[0 1 2 3]
"""


print(np.amin(a, axis=1))
"""
[ 0 10]
"""


print(np.amin(a, axis=0, keepdims=True))
"""
[[0 1 2 3]] 
"""


print(np.amin(a, axis=1, keepdims=True))
"""
[[ 0]
 [10]]
"""