[Numpy-discussion] how to build a series of arrays as I go?

Chris Withers chris at simplistix.co.uk
Mon Mar 17 13:16:46 EDT 2008


Charles Doutriaux wrote:
> 1-)You could use the concatenate function to grow an array as you go.

Thanks. Would it be more efficient to build the whole set of arrays as 
lists first or build them as arrays and use concatenate?

> 2-) assumnig you still have your list
> 
> b=numpy.array(data[name])
> bmasked=numpy.ma.masked_equal(b,-1)

Excellent, although I ended up using numpy.nan just ot be paranoid, in 
case -1 actually showed up in my data...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the NumPy-Discussion mailing list