2011/4/21, Jeff Reback <jreb...@yahoo.com>:
> Any thoughts on this?
>
>
>>>
>>
>>> I have a table of the following form
>>>
>>>             table = self.handle.createTable(group, 'table', dict(
>>>                 index = tables.Time64Col(),
>>>                 column = tables.StringCol(25),
>>>                 values = tables.FloatCol(shape=(number_fields)),
>>>                 ))
>>>
>>> I select values like this:
>>>  table.readWhere(index >= 1273032000.0) & (index <= 1302840000.0) &
>>> ((column == 'IBM.N') | (column == 'AAPL.O')) )

Hmm, this seems to work just fine here.  See this example:

{{{
import tables

handle = tables.openFile("/tmp/p.h5", "w")

table = handle.createTable(handle.root, 'table', dict(
          index = tables.Time64Col(),
          column = tables.StringCol(25),
          values = tables.FloatCol(shape=(3)),
          ))

r = table.row
for i in xrange(1000):
    r['index'] = i
    r['column'] = ("str-%d"%i)
    r.append()
table.flush()

ans = table.readWhere("(index >= 1) & (index <= 10) & \
                          ((column == 'str-0') | (column == 'str-1'))")
print "ans-->", ans
handle.close()
}}}

and the output:

{{{
ans--> [('str-1', 1.0, [0.0, 0.0, 0.0])]
}}}

Which is the correct answer.  Perhaps you forgot the quotes on the
query expression?

Cheers,

-- 
Francesc Alted

------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to