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-utilsVerified import paths — ran on the pinned version, not inferred.
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.
Install the library with the `accel` extra: `pip install 'fast-array-utils[accel]'`.
Ensure that input arrays conform to one of the explicitly supported types. Convert arrays if necessary before passing them to `fast-array-utils` functions.
Ensure your Python environment is running Python 3.12 or higher. Upgrade Python if needed.
Install `fast-array-utils` with the 'accel' extra: `pip install 'fast-array-utils[accel]'`.
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.