[SciPy-user] Converting arrays to dates for plot_date()
Fri May 2 08:15:26 CDT 2008
On Fri, May 2, 2008 at 7:21 AM, Dharhas Pothina
> Thank you John, I tried that and got the error message :
> TypeError: descriptor 'date' requires a 'datetime.datetime' object but received a 'numpy.float64'
> but using datetime() rather than datetime.date() seems to work.
I think the problem may be that you had floats rather than ints in
your "year" array. For example, the following does work:
In : data = array([1,2])
In : year = array([2006,2007])
In : month = array([11,12])
In : day = array([1,2])
In : dates = [datetime.date(y,m,d) for y,m,d in zip(year, month, day)]
In : dates
Out: [datetime.date(2006, 11, 1), datetime.date(2007, 12, 2)]
> fyi. y'all have a great community here. I've asked two questions in the last few days and was
> answered quickly and correctly on both occasions.
Glad to help.
More information about the SciPy-user