[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. __

Re: [Numpy-discussion] Outer join ?

2009-02-12 Thread A B
On 2/11/09, Robert Kern wrote: > On Wed, Feb 11, 2009 at 23:24, A B wrote: >> Hi, >> >> I have the following data structure: >> >> col1 | col2 | col3 >> >> 20080101|key1|4 >> 20080201|key1|6 >> 20080301|key1|5 >> 20080301|key2|3.4

Re: [Numpy-discussion] Outer join ?

2009-02-12 Thread A B
ol1'])), dtype=dict(names=['dates', > 'key1', 'key2'] , types=[long, float, float])) > > for i, (date, items) in enumerate(groupby(a, lambda item: item > ['col1'])): > data[i][dates] = date > for col1, col2, col3 in items: >

[Numpy-discussion] Outer join ?

2009-02-11 Thread A B
Hi, I have the following data structure: col1 | col2 | col3 20080101|key1|4 20080201|key1|6 20080301|key1|5 20080301|key2|3.4 20080601|key2|5.6 For each key in the second column, I would like to create an array where for all unique values in the first column, there will be either a value or zer

Re: [Numpy-discussion] loadtxt issues

2009-02-11 Thread A B
On Wed, Feb 11, 2009 at 6:27 PM, A B wrote: > On Tue, Feb 10, 2009 at 9:52 PM, Brent Pedersen wrote: >> On Tue, Feb 10, 2009 at 9:40 PM, A B wrote: >>> Hi, >>> >>> How do I write a loadtxt command to read in the following file and >>> store

Re: [Numpy-discussion] loadtxt issues

2009-02-11 Thread A B
On Tue, Feb 10, 2009 at 9:52 PM, Brent Pedersen wrote: > On Tue, Feb 10, 2009 at 9:40 PM, A B wrote: >> Hi, >> >> How do I write a loadtxt command to read in the following file and >> store each data point as the appropriate data type: >> >> 12|h|34.5|4

[Numpy-discussion] loadtxt issues

2009-02-10 Thread A B
Hi, How do I write a loadtxt command to read in the following file and store each data point as the appropriate data type: 12|h|34.5|44.5 14552|bbb|34.5|42.5 Do the strings have to be read in separately from the numbers? Why would anyone use 'S10' instead of 'string'? dt = {'names': ('gender',