For example, I have a variable which point to a vector contains many elements in memory, I want to copy element in vector to a numpy array, what should I do except one by one copy? Thx
Tell me more
×
Stack Overflow is a question and answer site for
professional and enthusiast programmers. It's 100% free, no registration required.
I am assuming that your vector can be represented like that:-
Casting it as a
|
|||
|
If the data is packed in a buffer in native float format:
|
|||
|
a = np.asarray(vec)
? – tcaswell Nov 14 '12 at 16:00