[SciPy-User] fromstring and int64
Carlos Medrano
ctmedra at unizar.es
Wed Oct 21 12:23:38 EDT 2015
Hello,
I am having an issue with function fromstring and long integers
(int64). It seems it cannot read properly long numbers. I use scipy
version 0.14.0 and numpy 1.8.2. I have the problem also if I use numpy
directly.
import scipy
s='0 1445367600061 -35960 39671 79230'
scipy.fromstring(s, sep=' ', dtype=scipy.int64)
I get this
array([ 0, 2147483647, -35960, 39671, 79230], dtype=int64)
which is wrong in the second element
However if I write to a file the string s and use loadtxt, I get the
right values:
f=open('dumf.txt','w')
f.write(s)
f.close()
scipy.loadtxt('dumf.txt', dtype=scipy.int64)
I get:
array([0, 1445367600061, -35960, 39671, 79230], dtype=int64)
I think this can be a bug a I would like to check on the mailing list
first and see if other people have the same behaviour.
Regards
Carlos Medrano
More information about the SciPy-User
mailing list