Registry / data / fast-array-utils

fast-array-utils

JSON →
library1.4.1pypypi✓ verified 90d ago

Fast Array Utilities (fast-array-utils) is a Python library providing high-performance array manipulation and statistical utilities with minimal dependencies. It supports a wide range of array types including `numpy.ndarray`, `scipy.sparse` formats, `cupy.ndarray`, `dask.array.Array`, `h5py.Dataset`, `zarr.Array`, and `anndata.abc.CS{CR}Dataset`. The current version is 1.4.1, with an active development status and regular updates within the `scverse` ecosystem.

pip install fast-array-utils
INSTALL
IMPORT
SIG · FAST-ARRAY-UTILS
F
fast-array-utils
datapythonv1.4.1
Install
4.6s avg
Import
526ms
Disk
86MB
Pass rate
3/ 10
Env Coverage3 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.3.1 · 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
✕ build_error
✕ build_error
py 3.11
8/12 runs
✓ 4.62s
py 3.12
8/12 runs
✓ 4.52s
py 3.13
8/12 runs
✓ 4.58s
py 3.9
✕ build_error
✕ build_error
86MB installed
● package 86MB
Code
Verified usage

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

to_dense
✓ from fast_array_utils.conv import to_dense
stats
✓ from fast_array_utils import stats
conv
✓ from fast_array_utils import conv

This quickstart demonstrates converting a sparse matrix to a dense NumPy array using `to_dense` from the `conv` submodule and calculating statistics like sums and means using the `stats` submodule. Note that the `stats` submodule requires the optional `accel` dependencies to be installed.

import numpy as np from scipy.sparse import csr_matrix from fast_array_utils.conv import to_dense from fast_array_utils import stats # Example with to_dense sparse_matrix = csr_matrix(np.array([[0, 1, 0], [1, 0, 2], [0, 0, 0]])) numpy_arr = to_dense(sparse_matrix) print(f"Dense array from sparse matrix:\n{numpy_arr}") # Example with stats module (requires 'fast-array-utils[accel]' to be installed) try: data_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) col_sums = stats.sum(data_2d, axis=0) mean_val = stats.mean(data_2d) print(f"\nColumn sums: {col_sums}") print(f"Mean value: {mean_val}") except ImportError: print("\nSkipping stats examples: 'fast-array-utils[accel]' not installed.")
Debug
Known issues
gotchaThe `fast_array_utils.stats` and `fast_array_utils.numba` submodules require `numba` for their functionality. These are installed via the `accel` extra (e.g., `pip install 'fast-array-utils[accel]'`). Without this, attempts to import or use functions from these modules will result in `ImportError` or `ModuleNotFoundError`.
fix
Install the library with the `accel` extra: `pip install 'fast-array-utils[accel]'`.
affects: All versions
gotchaThe library is designed to work efficiently with specific array types: `numpy.ndarray`, `scipy.sparse.cs{rc}_{array,matrix}`, `cupy.ndarray`, `cupyx.scipy.sparse.cs{rc}_matrix`, `dask.array.Array`, `h5py.Dataset`, `zarr.Array`, and `anndata.abc.CS{CR}Dataset`. Passing unsupported array types may lead to unexpected `TypeError` or incorrect behavior, particularly when using conversion or statistical functions.
fix
Ensure that input arrays conform to one of the explicitly supported types. Convert arrays if necessary before passing them to `fast-array-utils` functions.
affects: All versions
gotchaThe library primarily operates on Python 3.12 and newer. While some older versions might support Python 3.11, the official documentation for version 1.4 and current PyPI metadata specify a minimum requirement of Python >=3.12.
fix
Ensure your Python environment is running Python 3.12 or higher. Upgrade Python if needed.
affects: <=1.4.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fast_array_utils.stats'
The `stats` submodule (and `numba` submodule) depends on `numba` for accelerated operations. This dependency is optional and must be installed via an 'extra' package.
fix
Install `fast-array-utils` with the 'accel' extra: `pip install 'fast-array-utils[accel]'`.
TypeError: Cannot convert array-like to SparseArray: expecting 1D or 2D array, got a 0D array
This (or similar `TypeError`s related to array shape or type) indicates that the array being passed to a utility function is not in a format or shape that `fast-array-utils` expects for that particular operation. For instance, some functions might expect 2D arrays, or specific sparse formats.
fix
Inspect the array type and shape. Ensure it matches the requirements of the `fast-array-utils` function being called. Convert the array to a supported type (e.g., `numpy.ndarray`, `scipy.sparse.csr_matrix`) and reshape if necessary.
Upgrade
Version history
1.4.1latest on PyPI · released Apr 10, 2026
Audit
Dependencies
numpyrequiredCore dependency for array operations.
numbaoptionalRequired for `fast_array_utils.stats` and `fast_array_utils.numba` submodules to enable accelerated computations.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
fast-array-utils — pip install fast-array-utils · libregistry