[Numpy-discussion] Database with Nulls to Numpy Structure
Fri Oct 2 14:33:35 CDT 2009
Mark Janikas wrote:
> So, do I use lists and
> append then create the arrays… Or do I fill up the pre-allocated “empty”
> arrays and slice off the ends? Thoughts? Thanks much…
Either will work. I think the decision would be based on how many Null
records you expect -- if it's a small fraction then go ahead and
pre-allocate the array, if it's a large fraction, then you might want to
go with a list.
Note: you may be able to use arr.resize() to chop it off at the end.
The list method has the downside of using more memory, and being a bit
slower, which may be mitigated if there are lots of null records.
See an upcoming email of mine for another option...
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