|
From: Helvio P. G. <he...@gm...> - 2011-05-24 12:11:58
|
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 |