[Numpy-discussion] Reversing RecArrays

Francesc Altet faltet at carabos.com
Wed Mar 9 10:47:19 EST 2005


I would be interested in having a fast way to reverse RecArrays.
Regrettably, the most straightforward way to reverse them does not
work properly:

>>> from numarray import records
>>> r = records.array([('Smith', 1234),\
...                ('Johnson', 1001),\
...                ('Williams', 1357),\
...                ('Miller', 2468)], \
...                names='Last_name, phone_number')
>>> r[::-1]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/numarray/records.py", line 749, in 
  File "/usr/lib/python2.3/site-packages/numarray/records.py", line 797, in 
  File "/usr/lib/python2.3/site-packages/numarray/records.py", line 736, in 
    self._fields = self._get_fields()  # Refresh the cache
  File "/usr/lib/python2.3/site-packages/numarray/records.py", line 705, in 
  File "/usr/lib/python2.3/site-packages/numarray/strings.py", line 112, in 
    raise ValueError("Inconsistent string and array parameters.")
ValueError: Inconsistent string and array parameters.

Anyway, anybody knows if there is some way to achieve this (until this
bug would be eventually fixed, of course)?


>qo<   Francesc Altet     http://www.carabos.com/
V  V   Cárabos Coop. V.   Enjoy Data

More information about the NumPy-Discussion mailing list