You can do it:
from_date=datetime.datetime(2002,3,17,0,0,0) to_date=from_date+datetime.timedelta(days=1) idx=(A[:,0]>from_date) & (A[:,0]<=to_date) print(A[idx])
A[:,0] is the first column of A
Unfortunately, comparing A[:,0] with a datetime.date object raises a TypeError. However, a comparison with the datetime.datetime object works:
In [63]: A[:,0]>datetime.datetime(2002,3,17,0,0,0) Out[63]: array([False, True, True, True, True, True, True, True, True, True], dtype=bool)
In addition, unfortunately,
datetime.datetime(2002,3,17,0,0,0)<A[:,0]<=datetime.datetime(2002,3,18,0,0,0)
also raises a TypeError, since it calls the datetime.datetime __lt__ method instead of the numpy array __lt__ . Perhaps this is a mistake.
In any case, this is not difficult to get around; you can say
In [69]: (A[:,0]>datetime.datetime(2002,3,17,0,0,0)) & (A[:,0]<=datetime.datetime(2002,3,18,0,0,0)) Out[69]: array([False, True, True, True, True, False, False, False, False, False], dtype=bool)
Since this gives you a boolean array, you can use it as a "fancy index" for A , which gives the desired result.