[Tutor] using datetime and calculating hourly average
Alan Gauld
alan.gauld at btinternet.com
Thu Jul 9 02:40:05 CEST 2009
"John [H2O]" <washakie at gmail.com> wrote
> --> 196 ind = np.where( (t1 < Y[:,0] < t2) ) #same result
>
> TypeError: can't compare datetime.datetime to numpy.ndarray
Have you checked what you are comparing?
Try printing Y[:,0]
It looks like an invalid test and no amolunt of parenthesising
or 'and'ing will make it work.
> --> 196 ind = np.where( (Y[:,0]>t1) and (Y[:,0]<t2) )
>
> ValueError: The truth value of an array with more than one element is
> ambiguous. Use a.any() or a.all()
Looks like the Y[:,0] value is not compatible with the time t1 or t2.
What does
print Y[:,0]
produce?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list