KxSystems / pyq

PyQ — Python for kdb+
http://code.kx.com/q/interfaces
Apache License 2.0
190 stars 49 forks source link

numpy matrix #9

Closed vincentleung58 closed 7 years ago

vincentleung58 commented 7 years ago

Has anyone seen examples of passing numpy/panda matrices into KDB and vice versa?

abalkin commented 7 years ago

In the next version of pyq we are implementing auto-conversion of dimensional numpy arrays to q nested lists:

>>> q.x = numpy.zeros((2,2,3))
>>> q.x
k('((0 0 0f;0 0 0f);(0 0 0f;0 0 0f))')

and back

>>> numpy.array(q.x)
array([[[ 0.,  0.,  0.],
        [ 0.,  0.,  0.]],

       [[ 0.,  0.,  0.],
        [ 0.,  0.,  0.]]])