vendredi 6 novembre 2015

How to copy a numpy array into an already existing list structure in Python?

I have already read this question here, but I am not sure it is doing what I am looking for exactly.

Basically, I already have an existing list structure called points that I have read-in. If I do:

print points[0:2]

then I get

[x: -42.243 y: 38.32432 z: -9.3 x: 34.243 y: -8.32432 z: 21.3]

Now, simply what I would like to do, is generate a say, 6x1 random vector, and have its contents be directly copied into the [x y z x y z] values of the above list. I can generate a random array via:

import random
import numpy as np
randomArray = np.random.rand(6,1)

, but how do I copy it's contents INTO points exactly?

Thanks!




Aucun commentaire:

Enregistrer un commentaire