Hi all, I would like to know if anybody knows a work around in pytables that will allow to regain numpy's behavior with repeated indices. See code below.
import numpy as np import tables N=5 M=5 A=np.arange(N*M, dtype=float).reshape(N,M) with tables.openFile("file.h5", "w") as f: B=f.createCArray(f.root,"B", tables.Float64Atom(), (N,M)) B[:]=A print A[0,[0,1,2]] print B[0,[0,1,2]] print A[0,[0,1,2,0]] print B[0,[0,1,2,0]] # However: IndexError: Selection lists cannot have repeated values $ python repeated_indices.py [ 0. 1. 2.] [ 0. 1. 2.] [ 0. 1. 2. 0.] Traceback (most recent call last): File "repeated_indices.py", line 19, in <module> print B[0,[0,1,2,0]] # However: IndexError: Selection lists cannot have repeated values File "/share/distro/python/2.7.2/lib/python2.7/site-packages/tables/array.py", line 692, in __getitem__ selection, reorder, shape = self._fancySelection(key) File "/share/distro/python/2.7.2/lib/python2.7/site-packages/tables/array.py", line 622, in _fancySelection "Selection lists cannot have repeated values") IndexError: Selection lists cannot have repeated values Best regards, Ask ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users