{"id":7213,"library":"fast-array-utils","title":"Fast Array Utilities","description":"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.","status":"active","version":"1.4.1","language":"python","source_language":"en","source_url":"https://github.com/scverse/fast-array-utils","tags":["array","utilities","performance","numpy","scipy","cupy","dask","numba","data-science"],"install":[{"cmd":"pip install fast-array-utils","lang":"bash","label":"Base installation"},{"cmd":"pip install 'fast-array-utils[accel]'","lang":"bash","label":"With Numba acceleration (for stats and numba modules)"},{"cmd":"pip install 'fast-array-utils[testing]'","lang":"bash","label":"With testing utilities"}],"dependencies":[{"reason":"Core dependency for array operations.","package":"numpy","optional":false},{"reason":"Required for `fast_array_utils.stats` and `fast_array_utils.numba` submodules to enable accelerated computations.","package":"numba","optional":true}],"imports":[{"symbol":"to_dense","correct":"from fast_array_utils.conv import to_dense"},{"symbol":"stats","correct":"from fast_array_utils import stats"},{"symbol":"conv","correct":"from fast_array_utils import conv"}],"quickstart":{"code":"import numpy as np\nfrom scipy.sparse import csr_matrix\nfrom fast_array_utils.conv import to_dense\nfrom fast_array_utils import stats\n\n# Example with to_dense\nsparse_matrix = csr_matrix(np.array([[0, 1, 0], [1, 0, 2], [0, 0, 0]]))\nnumpy_arr = to_dense(sparse_matrix)\nprint(f\"Dense array from sparse matrix:\\n{numpy_arr}\")\n\n# Example with stats module (requires 'fast-array-utils[accel]' to be installed)\ntry:\n    data_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n    col_sums = stats.sum(data_2d, axis=0)\n    mean_val = stats.mean(data_2d)\n    print(f\"\\nColumn sums: {col_sums}\")\n    print(f\"Mean value: {mean_val}\")\nexcept ImportError:\n    print(\"\\nSkipping stats examples: 'fast-array-utils[accel]' not installed.\")\n","lang":"python","description":"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."},"warnings":[{"fix":"Install the library with the `accel` extra: `pip install 'fast-array-utils[accel]'`.","message":"The `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`.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment is running Python 3.12 or higher. Upgrade Python if needed.","message":"The 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.","severity":"gotcha","affected_versions":"<=1.4.x"}],"env_vars":null,"search_vec":"'1.4.1':51 'activ':54 'anndata.abc.cs':44 'array':2,5,9,19,33,64 'cr':45 'cupi':69 'cupy.ndarray':39 'current':48 'dask':70 'dask.array.array':40 'data':73 'data-sci':72 'dataset':46 'depend':26 'develop':55 'ecosystem':63 'fast':1,4,8 'fast-array-util':7 'format':38 'h5py.dataset':41 'high':17 'high-perform':16 'includ':35 'librari':14 'manipul':20 'minim':25 'numba':71 'numpi':67 'numpy.ndarray':36 'perform':18,66 'provid':15 'python':13 'rang':31 'regular':58 'scienc':74 'scipi':68 'scipy.sparse':37 'scvers':62 'statist':22 'status':56 'support':28 'type':34 'updat':59 'util':3,6,10,23,65 'version':49 'wide':30 'within':60 'zarr.array':42","created_at":"2026-04-16T13:48:36.076313+00:00","updated_at":"2026-04-16T13:48:36.076313+00:00","problems":[{"fix":"Install `fast-array-utils` with the 'accel' extra: `pip install 'fast-array-utils[accel]'`.","cause":"The `stats` submodule (and `numba` submodule) depends on `numba` for accelerated operations. This dependency is optional and must be installed via an 'extra' package.","error":"ModuleNotFoundError: No module named 'fast_array_utils.stats'"},{"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.","cause":"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.","error":"TypeError: Cannot convert array-like to SparseArray: expecting 1D or 2D array, got a 0D array"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.4.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/scverse/fast-array-utils","docs":"https://icb-fast-array-utils.readthedocs-hosted.com/","changelog":null,"pypi":"https://pypi.org/project/fast-array-utils/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}