
How to transform pykx list of lists to .np() matrix
Hi! I am trying to transform a list of lists to a numpy matrix. For example, this array:
arr = kx.toq(np.random.rand(3,2)) We tried to transform it with the .np method:
arr.np() But the result of this was an array of objects, which cannot be easily translated to a normal array:
array([array([0.9092564 , 0.40209283]), array([0.06786111, 0.50098914]), array([0.04279995, 0.50821769])], dtype=object) Now we are using:
np.array(arr.py()) It works but this solution is very slow. Is there a way to transform lists of q’s lists into numpy arrays without going through python?
Thanks for your help!
Marcos
Log in to reply.