On Wed, Mar 26, 2014 at 2:23 PM, Slaunger <[email protected]> wrote:

> Only I did not know about the append and insert methods. Very, very nice!
> (I
> only knew concatenate, which would be clumsy for just appending one
> element),
>
Sorry -- I dont have the time to actually figure out what you are doing,
but:::

note that  numpy arrays are not re-sizable, so np.append() and np.insert()
have to make a new array, and copy all the old data over. If you are
appending one at a time, this can be pretty darn slow.

I wrote a "grow_array" class once, it was a wrapper around a numpy array
that pre-allocated extra data to make appending more efficient. It's kind
of half-baked code now, but let me know if you are interested.

-Chris





-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to