[Numpy-discussion] strange conversion integer to float

Alex van Houten sparrow2867 at yahoo.com
Sat Dec 17 11:32:12 EST 2011


Try this:
$ python
Python 2.7.1 (r271:86832, Apr 12 2011, 16:15:16) 
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.5.1'
>>> time=[]
>>> time.append(20091231)
>>> time_array=np.array(time,'f')
>>> time_array
array([ 20091232.], dtype=float32)
20091231--->20091232 Why?
Note:
>>> float(20091231)
20091231.0

Thanks,
Alex.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111217/84287c6c/attachment.html>


More information about the NumPy-Discussion mailing list