Francesc Alted <faltet <at> pytables.org> writes:

> 
> A Friday 01 July 2011 02:21:04 Anthony Scopatz escrigué:
> > Hi Jason,
> > 
> > Glad we could help, and that your problem seemed to get worked out.
> > 
> > I agree that VLArrayCol would be nice, even though I still think that
> > nested tables handle this (albeit with a little more syntax).  Feel
> > free to open an issue on github about this, including some of the
> > comments and references here.
> 
> A VLArrayCol capability and nested tables are quite orthogonal.  I've 
> always whished to add such a VLArrayCol feature, but never do that.  
> However, for keeping the high speed access to regular Table objects, I'd 
> rather use another table object (say, CTable), where the data is 
> arranged column-wise, not row-wise as in current implemementation of a 
> Table.
> 

Hi Anthony:

Could you please include a short example of a nested table in a table?

I am finding the row.append() command messing things up.

Here's a dummy example:

    # open a file in 'w'rite mode
    h5f = pt.openFile(file, mode='w', title='Test')
    # get HDF5 root group
    root = h5f.root
    
    table = h5f.createTable(root, 'table', Funds)
    row = table.row
    # populate table
    for i in range(10):
        row['code'] = 'ABCD'
        row['name'] =  'Fund Name'
        row['type'] = 'Type'
        for j in range(20):
            data1 = i*100 + j*10
            data2 = i*1. + j*0.1
            row['Data/price'] = data1
            row['Data/dividend'] = data2
            row.append()    
    table.flush()
    h5f.close()

where:

class Data_(pt.IsDescription):
    date = pt.Time32Col(pos=0)
    price = pt.Float32Col(pos=1)
    dividend = pt.Float32Col(pos=2)

class Funds(pt.IsDescription):
    code = pt.StringCol(itemsize=4,dflt="",pos=0)
    name = pt.StringCol(itemsize=80,dflt="",pos=1)
    type = pt.StringCol(itemsize=80,dflt="",pos=2)
    data = Data()

Thanks!

Salman



------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to