On Tue, May 01, 2007 at 12:05:20PM -, Simon Berube wrote:
> Alternatively, as a hackjob type check you could also do an
> "isinstance" check on the first element of the array since, unlike
> lists, arrays have uniform elements all the way through.
Or use
N.issubdtype(x.dtype,int) and N.issu
When using numpy array the type of the array is given by the "dtype"
variable of the array. So if your array is int then array.dtype will
be 'int32'. Numpy uses more complex data types then just int and
floats so you might want to check all the available data types.
Ex:
In [168]: a = array([1,2,3
dmitrey wrote:
> hi all,
> please inform me what is the simplest way to check, does the vector x
> that came to my func is float or integer. I.e. someone can pass to my
> func for example x0 = numpy.array([1, 0, 0]) and it can yield wrong
> unexpected results vs numpy.array([1.0, 0, 0]) .
Usual
hi all,
please inform me what is the simplest way to check, does the vector x
that came to my func is float or integer. I.e. someone can pass to my
func for example x0 = numpy.array([1, 0, 0]) and it can yield wrong
unexpected results vs numpy.array([1.0, 0, 0]) .
Thx, D.
_