numpy-minmax is a fast Python library designed to efficiently find both the minimum and maximum values within a NumPy array. It achieves significant speedups (roughly 2.3x faster than calling `numpy.amin` and `numpy.amax` separately) by leveraging C implementations and SIMD instructions (AVX/AVX512). The library is actively maintained with frequent releases, with version 0.5.0 being the latest stable release as of June 2025.
pip install numpy-minmaxVerified import paths — ran on the pinned version, not inferred.
Initialize a NumPy array and use `numpy_minmax.minmax()` to quickly get both the minimum and maximum values. The function returns a tuple `(min_value, max_value)`.
Ensure input arrays are `float32` or `int16` and are C-contiguous, F-contiguous, or 1D strided when optimal performance is critical.
Always check the `CHANGELOG.md` or PyPI metadata for the `requires_python` field before upgrading or deploying to new Python environments.
Ensure the library is installed using pip: `pip install numpy-minmax`
Change the function call from `numpy_minmax.min_max(arr)` to `numpy_minmax.minmax(arr)`.
Before calling `numpy_minmax.minmax`, ensure the array is not empty. You can add a check like `if arr.size > 0: min_val, max_val = numpy_minmax.minmax(arr)`.
Convert the Python list to a NumPy array before passing it to the function: `import numpy as np; my_list = [1, 2, 3]; my_array = np.array(my_list); min_val, max_val = numpy_minmax.minmax(my_array)`.