Registry / data / numpy-minmax

numpy-minmax

JSON →
library0.6.0pypypi✓ verified 21d ago

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-minmax
INSTALL
IMPORT
SIG · NUMPY-MINMAX
N
numpy-minmax
datapythonv0.6.0
Install
3.7s avg
Import
251ms
Disk
89MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 3.8s
py 3.11
✓ —
✓ 3.6s
py 3.12
✓ —
✓ 3.5s
py 3.13
✓ —
✓ 4s
py 3.9
✕ build_error
✕ build_error
89MB installed
● package 89MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

minmax
from numpy_minmax import minmax

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)`.

import numpy as np from numpy_minmax import minmax arr = np.arange(1337, dtype=np.float32) min_val, max_val = minmax(arr) print(f"Min value: {min_val}") print(f"Max value: {max_val}") # Expected output: Min value: 0.0, Max value: 1336.0
Debug
Known issues
gotchaPerformance benefits of `numpy-minmax` are primarily realized for `float32` and `int16` arrays that are C-contiguous, F-contiguous, or 1D strided. For other data types or strided arrays with `ndim >= 2`, the function falls back to `numpy.amin` and `numpy.amax`, negating any performance gain.
fix
Ensure input arrays are `float32` or `int16` and are C-contiguous, F-contiguous, or 1D strided when optimal performance is critical.
affects: All versions
breakingThe library has a history of adjusting Python version support with minor releases. For example, version 0.5.0 added Python 3.13 support, while the upcoming 0.6.0 will remove Python 3.9 support. Users should consult the `CHANGELOG.md` on GitHub or PyPI for supported Python versions to ensure compatibility.
fix
Always check the `CHANGELOG.md` or PyPI metadata for the `requires_python` field before upgrading or deploying to new Python environments.
affects: 0.1.0 - 0.5.0 (and future versions)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'numpy_minmax'
The `numpy-minmax` library has not been installed in your Python environment or the environment where you are running your script.
fix
Ensure the library is installed using pip: `pip install numpy-minmax`
AttributeError: module 'numpy_minmax' has no attribute 'min_max'
You are attempting to call a function named `min_max` (with an underscore) which does not exist. The correct function name is `minmax` (without an underscore).
fix
Change the function call from `numpy_minmax.min_max(arr)` to `numpy_minmax.minmax(arr)`.
ValueError: zero-size array to reduction operation minmax which has no identity
The `numpy_minmax.minmax` function was called with an empty NumPy array, which does not have a defined minimum or maximum value without an identity element.
fix
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)`.
TypeError: 'list' object cannot be interpreted as an array
The `numpy_minmax.minmax` function expects a NumPy array as input, but a standard Python list was provided instead.
fix
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)`.
Upgrade
Version history
0.6.0latest on PyPI · released Jun 26, 2026
Audit
Dependencies
numpyrequiredCore functionality relies on NumPy arrays; compatible with numpy >=1.21,<2 for version 0.3.0 and later.
Agent activity
3 hits · last 30 days
node
2
Resources
numpy-minmax — pip install numpy-minmax · libregistry