NumPy data.min() Method: Find Minimum Values in Arrays
The 'data.min' method in NumPy returns the minimum value of an array along a specified axis. For example:
import numpy as np
arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr.min()) # output: 1
print(arr.min(axis=0)) # output: [1 2 3]
print(arr.min(axis=1)) # output: [1 4]
In the above example, 'arr.min()' returns the minimum value of the entire array, which is 1. 'arr.min(axis=0)' returns the minimum value of each column in the array, while 'arr.min(axis=1)' returns the minimum value of each row in the array.
原文地址: https://www.cveoy.top/t/topic/mwe0 著作权归作者所有。请勿转载和采集!