Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-18 Thread Robert Kern
On Tue, Mar 18, 2008 at 4:25 AM, Chris Withers <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > Appending to a list is almost always better than growing an array by > > concatenation. If you have a real need for speed, though, there are a > > few tricks you can do at the expense of complexity

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-18 Thread Chris Withers
Alexander Michael wrote: > Be default (if I understand correctly) the passing a regular array to > MaskedArray will not copy it, so it less redundant than it may at > first appear. The MaskedArray provides as masked *view* of the > underlying array data you give it. Cool, that was exactly what I w

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-18 Thread Alexander Michael
On Tue, Mar 18, 2008 at 5:27 AM, Chris Withers <[EMAIL PROTECTED]> wrote: > Travis E. Oliphant wrote: > > Generally, arrays are not efficiently re-sized. It is best to > > pre-allocate, or simply create a list by appending and then convert to > > an array after the fact as you have done. > > T

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-18 Thread Chris Withers
Travis E. Oliphant wrote: > Generally, arrays are not efficiently re-sized. It is best to > pre-allocate, or simply create a list by appending and then convert to > an array after the fact as you have done. True, although that feels like iterating over the data twice for no reason, which feels

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-18 Thread Chris Withers
Robert Kern wrote: > Appending to a list is almost always better than growing an array by > concatenation. If you have a real need for speed, though, there are a > few tricks you can do at the expense of complexity. I don't for this project but I might in future, where can I read about this? chee

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Anne Archibald
On 17/03/2008, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > Alan suggested: > > >> 1. http://www.scipy.org/Numpy_Example_List_With_Doc > > On Mon, 17 Mar 2008, Chris Withers apparently wrote: > > > Yeah, read that, wood, trees, can't tell the... > > Oh, then you might want > http://www.scipy.org

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Alan G Isaac
> Alan suggested: >> 1. http://www.scipy.org/Numpy_Example_List_With_Doc On Mon, 17 Mar 2008, Chris Withers apparently wrote: > Yeah, read that, wood, trees, can't tell the... Oh, then you might want http://www.scipy.org/Tentative_NumPy_Tutorial or the other stuff at http://www.scipy.or

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Travis E. Oliphant
Chris Withers wrote: > Hi All, > > I'm using xlrd to read an excel workbook containing several columns of > data as follows: > Generally, arrays are not efficiently re-sized. It is best to pre-allocate, or simply create a list by appending and then convert to an array after the fact as you h

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Robert Kern
On Mon, Mar 17, 2008 at 12:16 PM, Chris Withers <[EMAIL PROTECTED]> wrote: > Charles Doutriaux wrote: > > 1-)You could use the concatenate function to grow an array as you go. > > Thanks. Would it be more efficient to build the whole set of arrays as > lists first or build them as arrays and use

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Chris Withers
Alan G Isaac wrote: > On Mon, 17 Mar 2008, Chris Withers apparently wrote: >> woefully inadequate state of the currently available free >> documentation > > 1. http://www.scipy.org/Numpy_Example_List_With_Doc Yeah, read that, wood, trees, can't tell the... > 2. write some Small problem with t

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Chris Withers
Charles Doutriaux wrote: > 1-)You could use the concatenate function to grow an array as you go. Thanks. Would it be more efficient to build the whole set of arrays as lists first or build them as arrays and use concatenate? > 2-) assumnig you still have your list > > b=numpy.array(data[name])

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Alan G Isaac
On Mon, 17 Mar 2008, Chris Withers apparently wrote: > woefully inadequate state of the currently available free > documentation 1. http://www.scipy.org/Numpy_Example_List_With_Doc 2. write some Cheers, Alan Isaac ___ Numpy-discussion mailing list

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Charles Doutriaux
Hi Chris, 1-)You could use the concatenate function to grow an array as you go. 2-) assumnig you still have your list b=numpy.array(data[name]) bmasked=numpy.ma.masked_equal(b,-1) Chris Withers wrote: > Hi All, > > I'm using xlrd to read an excel workbook containing several columns of > data

[Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Chris Withers
Hi All, I'm using xlrd to read an excel workbook containing several columns of data as follows: for r in range(1,sheet.nrows): date = \ datetime(*xlrd.xldate_as_tuple(sheet.cell_value(r,0),book.datemode)) if date_cut_off and date < date_cut_off: continue for c in range(le