[SciPy-user] Table like array
oliphant at ee.byu.edu
Thu Mar 2 17:59:50 CST 2006
Michael Sorich wrote:
> On 3/1/06, *Travis Oliphant* <oliphant.travis at ieee.org
> <mailto:oliphant.travis at ieee.org>> wrote:
> Michael Sorich wrote:
> > Hi,
> > I am looking for a table like array. Something like a 'data frame'
> > object to those familiar with the statistical languages R and Splus.
> > This is mainly to hold and manipulate 2D spreadsheet like data,
> > tends to be of relatively small size (compared to what many people
> > seem to use numpy for), heterogenous, have column and row names, and
> > often contains missing data.
> You could subclass the ndarray to produce one of these fairly
> easily, I
> think. The missing data item could be handled by a mask stored along
> with the array (or even in the array itself). Or you could use a
> array as your core object (though I'm not sure how it handles the
> arbitrary (i.e. record-like) data-types yet).
> Thanks for the replies. You mention that missing data could be stored
> in the array itself. Can one use nan to indicate missing data? In some
> ways it seems more convenient to store this data in the array itself
> rather than have a second mask array.
Yes, that's the approach I usually take for floating-point data. There
are some speed concerns for large arrays because I think operations with
nans can be slower. But, I have not tested that statement recently.
More information about the SciPy-user