Suppose I have the following PyTable column descriptor:
import numpy as np
import tables as pt
class Date_t(pt.IsDescription):
year = pt.Int32Col(shape=(), dflt=2013, pos=0)
month = pt.Int32Col(shape=(), dflt=1, pos=1)
day = pt.Int32Col(shape=(), dflt=1, pos=2)
class Info(pt.IsDescription):
col1 = pt.Int32Col(shape=(), dflt=0, pos=0)
startdate = Date_t()
birthdate = Date_t()
col2 = pt.Int32Col(shape=(), dflt=0, pos=3)
enddate = Date_t()
col3 = pt.Int32Col(shape=(), dflt=0, pos=5)
col4 = pt.Int32Col(shape=(), dflt=0, pos=6)
How can I specify the position of 'startdate', 'birthdate', and 'enddate'?
I thought I could do something like:
startdate = Date_t(pos=1)
birthdate = Date_t(pos=2)
and redefine the Date_t class as:
class Date_t(pt.IsDescription):
def __init__(self, pos):
self._v_pos = pos
year = pt.Int32Col(shape=(), dflt=2013, pos=0)
month = pt.Int32Col(shape=(), dflt=1, pos=1)
day = pt.Int32Col(shape=(), dflt=1, pos=2)
but this gives me the error:
TypeError: object.new() takes no parameters
Any ideas?