[Numpy-discussion] fast duplicate of array

Alan G Isaac aisaac at american.edu
Sat Jan 23 14:20:32 EST 2010


Suppose x and y are conformable 2d arrays.
I now want x to become a duplicate of y.
I could create a new array:
x = y.copy()
or I could assign the values of y to x:
x[:,:] = y

As expected the latter is faster (no array creation).
Are there better ways?

Thanks,
Alan Isaac



More information about the NumPy-Discussion mailing list