Re: [Numpy-discussion] Filling gaps

2009-02-12 Thread Keith Goodman
On Thu, Feb 12, 2009 at 6:04 PM, Keith Goodman wrote: > On Thu, Feb 12, 2009 at 5:52 PM, Keith Goodman wrote: >> On Thu, Feb 12, 2009 at 5:22 PM, A B wrote: >>> Are there any routines to fill in the gaps in an array. The simplest >>> would be by carrying the last known observation forward. >>> 0

Re: [Numpy-discussion] Filling gaps

2009-02-12 Thread Keith Goodman
On Thu, Feb 12, 2009 at 5:52 PM, Keith Goodman wrote: > On Thu, Feb 12, 2009 at 5:22 PM, A B wrote: >> Are there any routines to fill in the gaps in an array. The simplest >> would be by carrying the last known observation forward. >> 0,0,10,8,0,0,7,0 >> 0,0,10,8,8,8,7,7 > > Here's an obvious hac

Re: [Numpy-discussion] Filling gaps

2009-02-12 Thread Keith Goodman
On Thu, Feb 12, 2009 at 5:22 PM, A B wrote: > Are there any routines to fill in the gaps in an array. The simplest > would be by carrying the last known observation forward. > 0,0,10,8,0,0,7,0 > 0,0,10,8,8,8,7,7 Here's an obvious hack for 1d arrays: def fill_forward(x, miss=0): y = x.copy()

Re: [Numpy-discussion] Filling gaps

2009-02-12 Thread Pierre GM
On Feb 12, 2009, at 8:22 PM, A B wrote: > Hi, > Are there any routines to fill in the gaps in an array. The simplest > would be by carrying the last known observation forward. > 0,0,10,8,0,0,7,0 > 0,0,10,8,8,8,7,7 > Or by somehow interpolating the missing values based on the previous > and next k

[Numpy-discussion] Filling gaps

2009-02-12 Thread A B
Hi, Are there any routines to fill in the gaps in an array. The simplest would be by carrying the last known observation forward. 0,0,10,8,0,0,7,0 0,0,10,8,8,8,7,7 Or by somehow interpolating the missing values based on the previous and next known observations (mean). Thanks. __