[Numpy-discussion] None as missing value

Keith Goodman kwgoodman at gmail.com
Mon Jul 3 00:27:52 CDT 2006


I have a list x

>> x
[[1, None], [2, 3]]

that I generate outside of numpy (with plain python). What is the best
way to convert x into an array? This doesn't work

>> asarray(x)

array([[1, None],
       [2, 3]], dtype=object)   <-- I'm hoping for something like dtype=float64

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.)

If there is nothing better than None, what's a fast way to take care
of the None's if x is faily large?




More information about the Numpy-discussion mailing list