[SciPy-user] Table like array

Travis Oliphant oliphant.travis at ieee.org
Wed Mar 1 02:36:17 EST 2006


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. 


It just occurred to me you might not have heard of RPy.  RPy is a Python 
interface to the R language.  Whether you want to actually interface 
with R or not.  It has defined something called the DataFrame class to 
interface with R's data-frames.

You could start there and just use arrays to store the actual column data...

http://rpy.sourceforge.net/rpy/doc/manual_html/DataFrame-class.html

That example shows that a simple data-frame is just a dictionary keyed 
by column name.  You could then add a key for your "row names" and use 
that to access data using row-names.   In fact, the record data-types 
are also dictionary-based (look at the fields method of a data-type 
object). 

It makes me think that you could get something very much what you want 
using your own class that just wraps 1-d arrays (or even lists).

-Travis




More information about the SciPy-User mailing list