Hi,

I have a problem. I need to find specific date in datetime.datetime vector.
Fox example, I've created a vector of dates and I want to find the positions
with february month. In Matlab the code is:

date1 = datenum([1981 1 1 0 0 0]); %date start
date2 = datenum([2010 12 31 0 0 0]); %date end
delta = datenum([2010 1 1 6 0 0]) - datenum([2010 1 1 0 0 0]); %interval -
6h
dates = date1:delta:date2; %creating vector of dates
dates = datevec(dates); %converting date to matrix
my_positions = find(dates(:,2)==2); %searching the positions with month=2
(february)

How is in numpy? How I search a specific date? The beginning of code is:

import datetime

date1 =datetime.datetime( 1981, 1, 1, 0, 0, 0); #date start
date2 = datetime.datetime( 2010, 12, 31, 0, 0, 0); #date end
delta = datetime.timedelta(hours=6); #interval - 6h
dates = drange(date1, date2, delta); #creating vector of dates

Thank's and best regards.

Helvio P. Gregório
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to