[Numpy-discussion] Dumping record arrays

Pierre GM pgmdevlist at mailcan.com
Thu Mar 30 19:55:05 EST 2006


Folks, 
I'd like to dump/pickle some record arrays. The pickling works, the unpickling 
raises a ValueError (on my version of numpy 0.9.6). (cf below).
Is this already corrected in the svn version ?
Thx


###########################################################################
#

x1 = array([21,32,14])
x2 = array(['my','first','name'])
x3 = array([3.1, 4.5, 6.2])
r = rec.fromarrays([x1,x2,x3], names='id, word, number')

r.dump('dumper')
rb=load('dumper')
---------------------------------------------------------------------------
exceptions.ValueError                                Traceback (most recent 
call last)

/home/backtopop/Work/workspace-python/pyflows/src/<ipython console>

/usr/lib64/python2.4/site-packages/numpy/core/numeric.py in load(file)
    331     if isinstance(file, type("")):
    332         file = _file(file,"rb")
--> 333     return _cload(file)
    334
    335 # These are all essentially abbreviations

/usr/lib64/python2.4/site-packages/numpy/core/_internal.py in 
_reconstruct(subtype, shape, dtype)
    251
    252 def _reconstruct(subtype, shape, dtype):
--> 253     return ndarray.__new__(subtype, shape, dtype)
    254
    255

ValueError: ('data-type with unspecified variable length', <function 
_reconstruct at 0x2aaaafcf1578>, (<class 'numpy.core.records.recarray'>, 
(0,), 'V'))






More information about the NumPy-Discussion mailing list