`to_coo` raises DeprecationWarning
aeisenbarth opened this issue · comments
Describe the bug
When constructing a matrix with sparse.DOK
and converting it to COO
, it always raises "DeprecationWarning: coords should be an ndarray", although I do not provide coords at all. Internally, sparse passes the DOK instance instead of a Numpy array.
To Reproduce
python -Werror -c "import sparse; sparse.DOK(shape=(1, 1)).to_coo()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "…/lib/python3.9/site-packages/sparse/_dok.py", line 210, in to_coo
return COO(self)
File "…/lib/python3.9/site-packages/sparse/_coo/core.py", line 215, in __init__
warnings.warn(
DeprecationWarning: coords should be an ndarray. This will raise a ValueError in the future.
Expected behavior
No warning is raised.
System
- OS and version: Ubuntu 22.04
sparse
version: 0.15.1- NumPy version: 1.26.4
- Numba version: 0.59.0
We're considering deprecating to_coo
/tocoo
methods completely, please use .asformat("coo")
or .asformat(sparse.COO)
instead.