[Numpy-discussion] dates, np.where finding months

John [H2O] washakie@gmail....
Wed Jan 20 15:12:25 CST 2010



Keith Goodman wrote:
> 
> 
> 
> Or maybe this is cleaner:
> 
>>> [date.month==1 for date in A[:,0]]
>    [True, True, False, True]
> 
> which can be used like this:
> 
>>> idx = np.array([date.month==1 for date in A[:,0]])
>>> A[idx,:]
> 
> array([[2010-01-01, 1],
>        [2010-01-02, 2],
>        [2010-01-05, 4]], dtype=object)
> _______________________________________________
> NumPy-Discussion mailing list
> 

That's the keeper! Thanks for the responses.
-- 
View this message in context: http://old.nabble.com/dates%2C-np.where-finding-months-tp27242195p27248729.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.



More information about the NumPy-Discussion mailing list