We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe. Allow assignment of DOK subarray without requiring creation of dense array.
Describe the solution you'd like
>>> import sparse >>> import numpy as np >>> array = sparse.DOK([3,4,5], dtype=np.int8) >>> subarray = sparse.DOK([4,5], dtype=np.int8) >>> subarray[1,1] = 1 >>> array[0] = subarray Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/tyler/lib/anaconda3/envs/glia/lib/python3.8/site-packages/sparse/_dok.py", line 317, in __setitem__ value = np.asanyarray(value) File "/home/tyler/lib/anaconda3/envs/glia/lib/python3.8/site-packages/numpy/core/_asarray.py", line 136, in asanyarray return array(a, dtype, copy=False, order=order, subok=True) File "/home/tyler/lib/anaconda3/envs/glia/lib/python3.8/site-packages/sparse/_sparse_array.py", line 222, in __array__ raise RuntimeError( RuntimeError: Cannot convert a sparse array to dense automatically. To manually densify, use the todense method.
Describe alternatives you've considered
>>> array[0] = subarray.todense() >>>
Additional context If subarray is huge and very sparse, todense is not feasible.
todense
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
Allow assignment of DOK subarray without requiring creation of dense array.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
If subarray is huge and very sparse,
todense
is not feasible.The text was updated successfully, but these errors were encountered: