【发布时间】:2016-10-04 16:23:03
【问题描述】:
我在 PyTables 中有一个大型整数 CArray(100 万行,50,000 列):
In [22]: fmat
Out[22]:
/fmat (CArray(1025461, 54123), shuffle, blosc(5)) ''
atom := Int32Atom(shape=(), dflt=0)
maindim := 0
flavor := 'numpy'
byteorder := 'little'
chunkshape := (9, 54123)
选择行很好:
In [24]: %timeit fmat[0]
10000 loops, best of 3: 46.5 µs per loop
但是选择列需要很长时间:
In [25]: %timeit fmat[:,0]
1 loop, best of 3: 25 s per loop
是否有一种有效的方法来索引列或转置数组以允许快速切片?
【问题讨论】:
标签: python arrays slice transpose pytables