Select specific day in an np.array containing datetime

0

I have a np.array.astype ('Datetime [s]') called T with several days at random times. I need to select a few days for separation.

I tried:

for i in np.arange(MinTime,MaxTime,np.timedelta64(1, 'D')):
    mask = (T > i) & (T < (i + np.timedelta64(1, 'D')))
    print (T[mask])

But adding a day brings problems since any day i returns part of the later day as well. Obviously I have to solve this, but I ask if there is any way more numpy / pandas / python to select dates any just with the day, something like :

print(T[T == '01-01-2006'])

See:

print (T[T == np.datetime64('01-01-2006')])

returns only on 01-01-2006 THE MIDNIGHT however I need all occurrences from 01-01-2006.

    
asked by anonymous 05.08.2016 / 01:32

1 answer

0
T[T.strftime("%Y-%m-%d")=='2006-01-01']

or

T[((T-np.datetime64('01-01-2006')).days==0)]

should work

    
05.08.2016 / 02:57