[Tutor] using datetime and calculating hourly average

John [H2O] washakie at gmail.com
Wed Jul 8 12:05:13 CEST 2009


The problem is I don't want date, I want the date AND hour, just not

As for the comparison, in numpy here's what happens when I change the way I
construct the where statements:

--> 196         ind = np.where( (t1 < Y[:,0] < t2) ) #same result
with/without inner parens
    197         screen_vals = Y[ind,1][0]
    198         #print 'X time: %s' % t1

TypeError: can't compare datetime.datetime to numpy.ndarray

OR trying the 'and' method:

--> 196         ind = np.where( (Y[:,0]>t1) and (Y[:,0]<t2) )
    197         #ind = np.where( (t1 < Y[:,0] < t2) )

    198         screen_vals = Y[ind,1][0]

ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()

Seems I might want to try and get some help over on the numpy list as was
mentioned, but I'll check back here for suggestions!


View this message in context: http://www.nabble.com/using-datetime-and-calculating-hourly-average-tp24370537p24388708.html
Sent from the Python - tutor mailing list archive at Nabble.com.

More information about the Tutor mailing list