Negative values with unsigned data types problems
![](https://secure.gravatar.com/avatar/5c7407de6b47afcd3b3e2164ff5bcd45.jpg?s=120&d=mm&r=g)
Hi, I'm writing this here because the numpy Trac seems down: {{{ Oops... Trac detected an internal error: The Trac Environment needs to be upgraded. Run trac-admin /home/scipy/trac/numpy upgrade" }}} Well, it seems that there are inconsistencies on creating arrays coming from negative values using unsigned integers: In [41]: numpy.asarray([-1], dtype='uint8') Out[41]: array([255], dtype=uint8) In [42]: numpy.asarray([-1], dtype='uint16') Out[42]: array([65535], dtype=uint16) until here it's fine, but: In [43]: numpy.asarray([-1], dtype='uint32') --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/faltet/python.nobackup/numpy/<ipython console> in <module>() /usr/local/lib/python2.5/site-packages/numpy/core/numeric.py in asarray(a, dtype, order) 129 are converted to base class ndarray. 130 """ --> 131 return array(a, dtype, copy=False, order=order) 132 133 def asanyarray(a, dtype=None, order=None): <type 'exceptions.TypeError'>: long() argument must be a string or a number, not 'list' and the same happens with 'uint64'. My numpy version is 1.0.dev3216 Regards, --
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Francesc Altet wrote:
It's back up. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Francesc Altet wrote:
It's back up. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (2)
-
Francesc Altet
-
Robert Kern