Incrementally populate scidby sparse matrix


Sorry if I am missing something obvious here. I am running SciDB-Py on the 15.12 CE VirtualBox VM.

I initialize a scidb sparse matrix as follows:
from scidbpy import connect from scipy.sparse import dok_matrix sdb = connect() S = dok_matrix((N,P),dtype=int) S[0,0] = 1 # scidb won't accept an empty sparse matrix X = sdb.from_sparse(S)
(I can’t initialize an empty sparse matrix – let me know if I’m wrong and if so how to do this.)

Then I have some data, and I want to put it in the matrix. For example,

Out[67]: 1
TypeError                                 Traceback (most recent call last)
<ipython-input-68-d9bd278e92e3> in <module>()
----> 1 X[0,0]=0
/home/scidb/anaconda3/lib/python3.5/site-packages/scidbpy/ in __setitem__(self, key, value)
   1300             key = [key]
   1301             value = [value]
-> 1302         if len(key) != len(value):
   1303             raise ValueError("Number of expressions does not match number "
   1304                              "of new attributes")

TypeError: object of type 'int' has no len()

What am I missing here? How do I change values in an existing scidb array from scidbpy?



I had the same problem.
The indexed assignment with [0,0] is not implemented. It now only supports adding a new attribute. Please take a look at adding “late” attributed to an existing array:

In my code, I managed to use a query with insert() operator to alter an array in place.