[Numpy-discussion] subset of array - statistics

bevan bevan07 at gmail.com
Sun Mar 16 18:36:19 EDT 2008


David Huard <david.huard <at> gmail.com> writes:

> 
> 
> Look at the timeseries package in scikits (only on svn i'm afraid). You'll 
find exactly what you're looking for. Conversion from daily to monthly or 
yearly time series is a breeze. Cheers, David
> 
> 2008/3/13, Joris De Ridder <Joris.DeRidder <at> ster.kuleuven.be>:
> 
> 
> I am new to the world of Python and numpy
> Welcome.
> <snip> 
> Assuming that yr, mth and rain are 1D arrays, you may try something along
> 
> 
> [[average(rain[(yr == y) & (mth == m)]) for m in unique(mth[yr==y])] for y in 
unique(yr)]
> 
> which gives you the monthly average rainfalls stored in lists, one for each 
year.
>

David and Joris,

Thank you both for your replies.  At the moment I have gone with the timeseries 
option as I think investing some time in understanding it will aid me with 
future projects.

I have a couple of questions but I'll post on scipy.
Thanks again 




More information about the NumPy-Discussion mailing list