[Numpy-discussion] dtype behavior
ctw
lists.20.chth@xoxy....
Thu Oct 9 10:45:32 CDT 2008
Hi -- Can somebody here explain the following behavior:
In [1]: tst = np.array([5.])
In [2]: tst
Out[2]: array([ 5.])
In [3]: tst.shape
Out[3]: (1,)
In [4]: tst.dtype
Out[4]: dtype('float64')
In [5]: tst.dtype = np.int
In [6]: tst
Out[6]: array([ 0, 1075052544])
In [7]: tst.dtype
Out[7]: dtype('int32')
In [8]: tst.shape
Out[8]: (2,)
Is this a bug? I'm running numpy version 1.1.1 and was trying to
convert the float array([5.]) to an int array([5]).
More information about the Numpy-discussion
mailing list