Basic usage#
import binsparse
import numpy as np
from scipy import sparse
import zarr
csr = sparse.random(1000, 100, format="csr", density=0.1, random_state=np.random.default_rng())
z = zarr.group()
binsparse.write(z, "csr", csr)
binsparse.read(z["csr"])
<1000x100 sparse matrix of type '<class 'numpy.float64'>'
with 10000 stored elements in Compressed Sparse Row format>