[Numpy-discussion] how to build a series of arrays as I go?
Alexander Michael
lxander.m@gmail....
Tue Mar 18 08:06:25 CDT 2008
On Tue, Mar 18, 2008 at 5:27 AM, Chris Withers <chris@simplistix.co.uk> wrote:
> Travis E. Oliphant wrote:
> > Generally, arrays are not efficiently re-sized. It is best to
> > pre-allocate, or simply create a list by appending and then convert to
> > an array after the fact as you have done.
>
> True, although that feels like iterating over the data twice for no
> reason, which feels a bit weird.
>
> In my case, I want to create a masked array, it would be nice to be able
> to do that straight from a list, rather than having to turn the list
> into an array and then turning the array into a masked array.
>
> If I'm off base on this, let me know :-)
>
> cheers,
>
> Chris
Be default (if I understand correctly) the passing a regular array to
MaskedArray will not copy it, so it less redundant than it may at
first appear. The MaskedArray provides as masked *view* of the
underlying array data you give it.
More information about the Numpy-discussion
mailing list