Skip to content Skip to sidebar Skip to footer

Python Numpy Where Function With Datetime

I have an array of daily date times over a period of 30 years. I am trying to filter this array by month and day using np.where so that I can find the average of the corresponding

Solution 1:

Since dates is a list, it cannot be used as a datetime, even if its elements are datetime type. So instead of

dates.month == i

you need something like

[d.month == i for d in months]

Post a Comment for "Python Numpy Where Function With Datetime"