sparse
Sparse n-dimensional arrays for the PyData ecosystem
What it is and what it does
Sparse provides multi-dimensional sparse array objects for the PyData ecosystem, built on NumPy and Numba. Unlike dense arrays where every element is stored, sparse arrays only store non-zero values and their coordinates, dramatically reducing memory use for data that is mostly zeros or empty. The library integrates with NumPy's API conventions, making it familiar to scientists and data engineers already working with NumPy arrays.
The package is actively maintained and sits in the top 5000 PyPI packages by download volume. It targets Python 3.10, 3.11, and 3.12, and carries a BSD 3-Clause License. The library is marked as pre-alpha in its development status, indicating the API may evolve, but it is actively developed with recent releases and community support channels.
Use it for:
- Store and manipulate large tensors with mostly zero values, such as sparse feature matrices in machine learning pipelines.
- Perform operations on high-dimensional sparse data without materializing dense intermediates.
- Integrate sparse array computations into NumPy-based scientific workflows with minimal API friction.
- Accelerate sparse array operations using Numba's JIT compilation for performance-critical code paths.
- Work with sparse representations of graphs, networks, or other naturally sparse data structures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides multi-dimensional sparse array data structures compatible with NumPy and Numba, enabling efficient storage and computation on arrays with mostly zero or missing values.
Yes, if you work with sparse high-dimensional data in scientific or machine learning contexts and want NumPy-compatible semantics. The low install friction, active maintenance, and permissive license make it a reasonable choice. Be aware the library is pre-alpha, so expect potential API changes; verify that the sparse formats and operations you need are supported before committing to a production dependency.
Install
sparse on PyPI
pip
pip install sparseuv
uv add sparsepoetry
poetry add sparseInstalling sparse
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with a release on 2026-08-14 and recent commits. Requires NumPy and Numba as runtime dependencies.
License in practice
BSD 3-Clause License permits commercial and private use with minimal restrictions; you must retain copyright notices and disclaimers in source distributions.
Quickstart
import sparse
import numpy as np
# Create a sparse array from a dense array
dense = np.array([[0, 0], [0, 2]])
sparse_arr = sparse.COO.from_numpy(dense)
print(sparse_arr)
Requires Python 3.11 or later.
Verify before relying
- Which sparse formats (COO, CSR, CSC, etc.) are supported by the library.
- Performance characteristics compared to other sparse array libraries for typical workloads.
- Extent of Numba JIT acceleration and which operations benefit most.
- API stability guarantees given the pre-alpha development status.
Package facts
| License | BSD 3-Clause License Copyright (c) 2018, Sparse developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — numpy, numba |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,543,346/month — #3,782 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sparse-0.19.2-py2.py3-none-any.whl
Keywords: sparse, numpy, scipy, dask
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
tiledbTileDB-Py provides a Python interface to the…
permissive · top 15,000 on PyPI
xarrayxarray adds dimension, coordinate, and…
permissive · top 5,000 on PyPI
fast-array-utilsConverts and computes statistics across sparse,…
copyleft · top 15,000 on PyPI
numbaggNumbagg provides fast N-dimensional aggregation…
unclear · top 5,000 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
tensorstoreTensorStore reads and writes large…
permissive · top 5,000 on PyPI
unfoldNdExtends PyTorch's unfold and fold operations to…
permissive · top 15,000 on PyPI
ndcubendcube manipulates, inspects, and visualizes…
unclear · top 15,000 on PyPI
linopylinopy builds linear, integer, and quadratic…
permissive · top 15,000 on PyPI
arraykitArrayKit provides C-extension implementations…
permissive · top 15,000 on PyPI