Tue Jul 20 12:24:41 CDT 2010
> > Ben and Pierre,
> > Thanks for the tips! Glad I chimed in here b/c I've definitely learned
> something. I'm often pulling data out from a database, so null records
> come back to me as None's. I'll be sure to set a CASE statement now that
> fills the NULLs in with an obviously junk value that I can mask from now
> > -paul
> Why not user your None as said junk value?
All my existing routines just throw values from the database (Postgres or MS SQL) cursor directly into numpy arrays. As Pierre pointed out, the None values force the array's dtype to object.
In : x
Out: array([2.5, 12.2, 5, None], dtype=object)
I could easily mask the Nones, but switching it over to a value such as -99999 would let it me keep the dtype as float or integer. Probably not a big deal at the moment, but I'm trying to adopt as many best practices as possible so nothing comes back to bite me later on. (Negative values are pretty rare in environmental data, so I think it's a safe bet).
More information about the SciPy-User