[Numpy-discussion] Howto create a record array from arrays without copying their data
Wed Aug 12 10:22:53 CDT 2009
I'm creating (actually calculating) a set of very large 1-d arrays
(vectors), which I would like to assemble into a record array so I can
access the data row-wise. Unfortunately it seems that all data of my
original 1-d arrays are getting copied in memory during that process.
Is there a way to get around that?
Basically what I do is:
arr1 = numpy.array([1, 4, 5], dtype=int)
arr2 = numpy.array([5.5, 6.6, 9.9], dtype=float)
recarray = numpy.core.rec.fromarrays([arr1, arr2], names=['col1', 'col2'])
When I now make a change in recarray like
recarray.col1 = 5000
I cannot see the change in arr1. (So that's why I assume that the data
is copied). Also in the numy book it tells that would be copied.
More information about the NumPy-Discussion