from numpy import * dt = dtype ([('a', 'b'), ('f4', 'i4')]) x = zeros ((1,), dt) x.dtype
r_[x,x].dtype
Hi list,
Apparently r_[x,x] does not necessarily have the same dtype as x:
dtype([('a', '|i1'), ('f4', ' import numpy
numpy.version.version '1.0rc1.dev3171' Does anybody know how to avoid this change of dtype?
Thanks, Martin.
Martin Wiechert wrote:
Hi list,
Apparently r_[x,x] does not necessarily have the same dtype as x:
from numpy import * dt = dtype ([('a', 'b'), ('f4', 'i4')]) x = zeros ((1,), dt) x.dtype
dtype([('a', '|i1'), ('f4', '
r_[x,x].dtype
dtype('object')
import numpy numpy.version.version
'1.0rc1.dev3171'
Does anybody know how to avoid this change of dtype?
Thanks for the check. It should be fixed now in SVN. There was an inappropriate force to object arrays which neglected this case. -Travis
Martin Wiechert wrote:
Hi list,
Apparently r_[x,x] does not necessarily have the same dtype as x:
from numpy import * dt = dtype ([('a', 'b'), ('f4', 'i4')]) x = zeros ((1,), dt) x.dtype
dtype([('a', '|i1'), ('f4', '
Did you mean to make a data-type that was a 1-byte integer followed by a 4-byte integer with field names of 'a' and 'f4'? Perhaps you meant: dtype([('a','f4'),('b','i4')]) which is a 4-byte float followed by a 4-byte integer. -Travis
On Sunday 17 September 2006 00:36, Travis Oliphant wrote:
Martin Wiechert wrote:
Hi list,
Apparently r_[x,x] does not necessarily have the same dtype as x:
from numpy import * dt = dtype ([('a', 'b'), ('f4', 'i4')]) x = zeros ((1,), dt) x.dtype
dtype([('a', '|i1'), ('f4', '
Did you mean to make a data-type that was a 1-byte integer followed by a 4-byte integer with field names of 'a' and 'f4'?
Perhaps you meant:
dtype([('a','f4'),('b','i4')])
which is a 4-byte float followed by a 4-byte integer.
Thanks for the hint. Actually, the code I posted was just for the sake of example. Still you correctly read my thoughts. Martin.
-Travis
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
participants (2)
-
Martin Wiechert
-
Travis Oliphant