I have numpy array:
>>> data
dtype([('date', '|O4'), ('value', '<f8')]
where date object is Python datetime.date object which consists of all days in one year: [2010-1-1, …, 2010-12-31] and value object is value data for corresponding date.
How can I return value data only for, let’s say, September?
You could use a boolean array to index
data:(data['dates']>=dt.date(2010,9,1)) & (data['dates']<dt.date(2010,10,1))is a boolean array of the same length asdata, which isTruefor all dates in September: