I have a record array w/ dates (O4) and floats.  If some of these
floats are NaN, np.save crashes (on my solaris platform but not on a
linux machine I tested on).  Here is the code that produces the bug:

In [1]: pwd
Out[1]: '/home/titan/johnh/python/svn/matplotlib/matplotlib/examples/data'

In [2]: import matplotlib.mlab as mlab

In [3]: import numpy as np

In [4]: r = mlab.csv2rec('aapl.csv')

In [5]: r.dtype
Out[5]: dtype([('date', '|O4'), ('open', '<f8'), ('high', '<f8'),
('low', '<f8'), ('close', '<f8'), ('volume', '<i4'), ('adj_close',
'<f8')])

In [6]: r.close[100:] = np.nan

In [7]: r.close
Out[7]: array([ 124.63,  127.46,  129.4 , ...,     NaN,     NaN,     NaN])

In [8]: np.save('mydata.npy', r)
------------------------------------------------------------
Traceback (most recent call last):
 File "<ipython console>", line 1, in ?
 File "/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/io.py",
line 158, in save
   format.write_array(fid, arr)
 File "/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/format.py",
line 272, in write_array
   cPickle.dump(array, fp, protocol=2)
SystemError: frexp() result out of range


In [9]: np.__version__
Out[9]: '1.2.0.dev5136'

In [10]: !uname -a
SunOS flag 5.10 Generic_118855-15 i86pc i386 i86pc
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to