[Numpy-discussion] fast duplicate of array

Alan G Isaac aisaac@american....
Sat Jan 23 13:20:32 CST 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