problem setting O type for datetime field in record arrays
15 Jun
2007
15 Jun
'07
12:32 a.m.
I can create a record array with datetime types using fromrecords if I
don't specify a dtype and let numpy determine the dtype. But when I
try and set the dtype at record array creation time, I get the error
below
In [17]: import numpy
In [18]: import datetime
In [19]: dt = datetime.datetime
In [20]: dt1 = dt.now()
In [21]: dt2 = dt.now()
In [22]: numpy.core.rec.fromrecords([[dt1, 0.5], [dt2, 1.0]],
names='date,height') Out[22]:
recarray([(datetime.datetime(2007, 6, 14, 13, 59, 20, 753356), 0.5),
(datetime.datetime(2007, 6, 14, 13, 59, 22, 946850), 1.0)],
dtype=[('date', '|O4'), ('height', '
6155
Age (days ago)
6155
Last active (days ago)
0 comments
1 participants
participants (1)
-
John Hunter