From: Pierre GM <pgm...@ma...> - 2006-07-03 06:02:13
|
Keith, > > Is there something better than None to represent missing values so > > that when I convert to numpy arrays (actually matrices) I'll be all > > set? (I could use -99, but that would be even more embarrassing than > > my python skills.) As Tim suggested, have a look at the masked array module. However, the result will NOT be exportable to matrices, unless you fill the missing value first (for example, with -99 ;)). I use MaskedArrays a lot, they're quite flexible. An alternative would be to use nan instead of None: >>> import numpy as N >>> x = [[1, nan], [2, 3]] >>> print N.matrix(x) [[ 1. nan] [ 2. 3. ]] Of course, the solution will depend on what you need... |