On Jan 8, 2008 4:32 PM, jimgardener <[EMAIL PROTECTED]> wrote: > hi, > (i posted this to numpy discussion grp couple of days back ..but it > fails to appear..)since it is needed for my work i would appreciate if > anyone can help me with this question > > > i have two ndarrays of 1000 elements each and want to copy all > elements from srcarray to destarray > > srcarray=numpy.array( [3973334.8381791776,........,382999.6748692277] ) > > arrsize=1000 > destarray=zeros(arrsize) > > i copied all items from src to dest by using > destarray[0:arrsize]=srcarray[0:arrsize] > > i don't know if this is the right way to do the copying. > is there a better(efficient?) way ? > jim
If you want the array to share the data, just use destarray = numpy.array(srcarray) Otherwise you can set the copy flag to False: destarray = numpy.array(srcarray,copy=False) bye, Francesco -- http://mail.python.org/mailman/listinfo/python-list