[SciPy-user] Converting arrays to dates for plot_date()

Robert Kern robert.kern at gmail.com
Fri May 2 14:01:33 EDT 2008


On Fri, May 2, 2008 at 8:15 AM, John Hunter <jdh2358 at gmail.com> wrote:
> On Fri, May 2, 2008 at 7:21 AM, Dharhas Pothina
>
> <Dharhas.Pothina at twdb.state.tx.us> wrote:
>
> > 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.

Actually, I think the problem is that you did

  import datetime

and he did

  from datetime import datetime

but neither of you actually showed the import statements you used.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the SciPy-User mailing list