In [68]:
import tables as tb
import numpy as np
n, k, d = 1000000, 20, 30
ind = np.random.rand(n) < .0001
ind = np.nonzero(ind)[0]
print len(ind), "rows to select out of", n
with tb.openFile("test3", "r") as f:
a = f.root.test
%timeit -r1 -n1 [a[i,...] for i in ind]
%timeit -r1 -n1 [a[i,...] for i in ind]
%timeit -r1 -n1 a[::n//100,...]
#%timeit -r1 -n1 [a[ind,...] for i in ind]
In [23]:
In [ ]: