[Numpy-discussion] seting the dtype for where...
Chris.Barker at noaa.gov
Fri Dec 1 14:22:12 CST 2006
I'd like to set the data type for what numpy.where creates. For example:
import numpy as N
N.where(a >= 5, 5, 0)
creates an integer array, which makes sense.
N.where(a >= 5, 5.0, 0)
creates a float64 array, which also makes sense, but I'd like a float32
array, so I tried:
N.where(a >= 5, array(5.0, dtype=N.float32), 0)
but I got a float64 array again.
How can I get a float32 array? where doesn't take a dtype argument --
maybe it should?
numpy version 1.0
More information about the Numpy-discussion