|
From: Aquil H. A. <aqu...@gm...> - 2012-07-03 00:16:20
|
Hello All,
I have a table that is indexed by two keys, and I would like to search for
duplicate keys. So here is my naive slow implementation: (code I posted on
stackoverflow)
import tables
h5f = tables.openFile('filename.h5')
tbl = h5f.getNode('/data','data_table') # assumes group data and table
data_table
counter += 0
for row in tbl:
ts = row['date'] # timestamp (ts) or date
uid = row['userID']
query = '(date == %d) & (userID == "%s")' % (ts, uid)
result = tbl.readWhere(query)
if len(result) > 1:
# Do something here
pass
counter += 1
if counter % 1000 == 0: print '%d rows processed'
--
Aquil H. Abdullah
aqu...@gm...
|