Recarray multiple column slicing returns IndexError
Issue #59
new
CPython numpy allows multiple column indexing of recarrays by passing a list of column strings e.g
In [9]: d
Out[9]:
memmap([(48367, 'G80101', 3, 'SR', 154062, 0, 0, inf, 1079.0, 1),
(48367, 'G80101', 3, 'SR', 155926, 0, 0, 1083.0, 1083.0, 3),
(48367, 'G80101', 3, 'SR', 161451, 0, 0, 1088.0, 1088.0, 4),
(48367, 'G80101', 3, 'SR', 154378, 0, 0, 1089.0, 1089.0, 3),
(48367, 'G80101', 3, 'SR', 154979, 0, 0, 1093.0, 1093.0, 3),
(48367, 'G80101', 3, 'SR', 159655, 0, 0, 1097.0, 1097.0, 4),
(48367, 'G80101', 3, 'SR', 156106, 0, 0, 1103.0, 1104.0, 3),
(48367, 'G80101', 3, 'SR', 156319, 153828, 0, 1108.0, 1108.0, 4),
(48367, 'G80101', 3, 'SR', 164293, 0, 0, 1113.0, 1113.0, 4),
(48367, 'G80101', 3, 'SR', 160215, 0, 0, 1113.0, 1113.0, 4),
(48367, 'G80101', 3, 'SR', 158418, 0, 0, 1115.0, 1115.0, 4),
(48367, 'G80101', 3, 'SR', 153798, 0, 0, 1117.0, inf, 2)],
dtype=[('f0', '<i4'), ('f1', 'S54'), ('f2', 'i1'), ('f3', 'S4'), ('f4', '<i4'), ('f5', '<i4'), ('f6', '<i4'), ('f7', '<f2'), ('f8', '<f2'), ('f9', 'i1')])
In [10]: d[['f1', 'f2']]
Out[10]:
array([('G80101', 3), ('G80101', 3), ('G80101', 3), ('G80101', 3),
('G80101', 3), ('G80101', 3), ('G80101', 3), ('G80101', 3),
('G80101', 3), ('G80101', 3), ('G80101', 3), ('G80101', 3)],
dtype=[('f1', 'S54'), ('f2', 'i1')])
Numpypy does not:
In [24]: d
Out[24]:
array([(48367, 'G80101', 3, 'SR', 154062, 0, 0, inf, 1079.0, 1),
(48367, 'G80101', 3, 'SR', 155926, 0, 0, 1083.0, 1083.0, 3),
(48367, 'G80101', 3, 'SR', 161451, 0, 0, 1088.0, 1088.0, 4),
(48367, 'G80101', 3, 'SR', 154378, 0, 0, 1089.0, 1089.0, 3),
(48367, 'G80101', 3, 'SR', 154979, 0, 0, 1093.0, 1093.0, 3),
(48367, 'G80101', 3, 'SR', 159655, 0, 0, 1097.0, 1097.0, 4),
(48367, 'G80101', 3, 'SR', 156106, 0, 0, 1103.0, 1104.0, 3),
(48367, 'G80101', 3, 'SR', 156319, 153828, 0, 1108.0, 1108.0, 4),
(48367, 'G80101', 3, 'SR', 164293, 0, 0, 1113.0, 1113.0, 4),
(48367, 'G80101', 3, 'SR', 160215, 0, 0, 1113.0, 1113.0, 4),
(48367, 'G80101', 3, 'SR', 158418, 0, 0, 1115.0, 1115.0, 4),
(48367, 'G80101', 3, 'SR', 153798, 0, 0, 1117.0, inf, 2)],
dtype=[('f0', '<i4'), ('f1', '|S54'), ('f2', '|i1'), ('f3', '|S4'), ('f4', '<i4'), ('f5', '<i4'), ('f6', '<i4'), ('f7', '<f2'), ('f8', '<f2'), ('f9', '|i1')])
In [25]: d[['f1', 'f2']]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-25-f85c3d8168ae> in <module>()
----> 1 d[['f1', 'f2']]
IndexError: too many indices for array