[Numpy-discussion] Resize method
Mon Nov 23 19:04:56 CST 2009
Colin J. Williams wrote:
> Thanks for this. My aim is to extract a row of data from a line in a
> file and append it to an array. The number of columns is fixed but, at
> the start, the number of rows is unknown.
That is exactly the kind of use-case I had in mind.
In fact, you can use it now if you use a custom dtype to hold your row
of data, rather than using a 2-d array.
> I think that I have sorted out the resize approach but I need more tests
> before I share it.
Please do, and consider adding to and/or making suggestions to
accumulator -- why should we all re-invent this wheel?
To be far, you can do what you need by accumulating in a python list,
then making an array out of it when you are done -- and it will probably
be faster, but *may* take more memory.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the NumPy-Discussion