[Numpy-discussion] resizing arrays
Charles R Harris
Fri Feb 15 10:56:06 CST 2008
On Fri, Feb 15, 2008 at 6:49 AM, Neal Becker <email@example.com> wrote:
> I have a situation where I'm going to save some data sets to plot, but I
> don't know a-priori how many sets there will be. I'm using this code:
> shape = list(phase_plots.shape)
> shape += 1
> phase_plots.resize (shape, refcheck=0)
> except NameError:
> phase_plots = empty ((1, 2*iterations+1, l))
> This works, I'm just wondering if this is a reasonable approach or if
> something else would be better (or more efficient).
> I'd just append the data to a list. Arrays aren't meant to be dynamic and
what you end up with is a bunch of reallocations and copies.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion