[Numpy-discussion] how to build a series of arrays as I go?
Mon Mar 17 11:47:40 CDT 2008
1-)You could use the concatenate function to grow an array as you go.
2-) assumnig you still have your list
Chris Withers wrote:
> 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 = \
> if date_cut_off and date < date_cut_off:
> for c in range(len(names)):
> name = names[c]
> cell = sheet.cell(r,c)
> if cell.ctype==xlrd.XL_CELL_EMPTY:
> value = -1
> elif cell.ctype==xlrd.XL_CELL_DATE:
> value = \
> value = cell.value
> Two questions:
> How can I build arrays as I go instead of lists?
> (ie: the last line of the above snippet)
> Once I've built arrays, how can I mask the empty cells?
> (the above shows my hack-so-far of turning empty cells into -1 so I can
> use masked_where, but it would be greato build a masked array as I went,
> for efficiencies sake)
> cheers for any help!
> PS: Slightly pissed off at actually paying for the book only to be told
> it'll be 2 days before I can even read the online version, especially
> given the woefully inadequate state of the currently available free
> documentation :-(
More information about the Numpy-discussion