[Numpy-discussion] subset of array - statistics

bevan bevan07@gmail....
Sun Mar 16 17:36:19 CDT 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