[Numpy-discussion] segfaulting numpy with dot and datetime

josef.pktd@gmai... josef.pktd@gmai...
Mon Dec 10 18:39:39 CST 2012


>>> np.__version__
'1.6.2'
>>> aa
array([1970-01-13 96:00:00, 1970-01-13 120:00:00, 1970-01-13 144:00:00,
       1970-01-13 168:00:00, 1970-01-13 192:00:00], dtype=datetime64[ns])
>>> np.dot(aa, [1])
<segfault>

reported at
http://stackoverflow.com/questions/13786209/regression-on-stock-data-using-pandas-and-matplotlib
discussion
https://groups.google.com/d/topic/pystatsmodels/5zpWBzSH8UE/discussion


using linalg is "safe" but I doubt this casting to float is the desired result

>>> np.linalg.pinv(aa[:,None])
array([[  1.87768878e-19,   1.87784114e-19,   1.87799350e-19,
          1.87814586e-19,   1.87829822e-19]])
>>> np.linalg.pinv(np.asarray(aa, float)[:,None])
array([[  1.87768878e-19,   1.87784114e-19,   1.87799350e-19,
          1.87814586e-19,   1.87829822e-19]])

Josef


More information about the NumPy-Discussion mailing list