[Numpy-discussion] numarray: "concatenate along new axis" returns 'unexpected' type
Sebastian Haase
haase at msg.ucsf.edu
Tue Feb 8 10:53:38 EST 2005
Hi,
from the numarray documentation:
<doc>
concatenate(arrs, axis=0)
Returns a new array containing copies of the data contained in all arrays # of
arrs= (a0, a1, ... an). The arrays ai will be concatenated along the
specified axis (default=0). All arrays ai must have the same shape along
every axis except for the one specified in axis. To concatenate arrays along
a newly created axis, you can use array((a0, ..., an)), as long as all arrays
have the same shape.
</doc>
Is it a bug that array((a0,a1)) returns different type that a0 ?
(type(a0)==type(a1))
>>> a = na.zeros((3,3),na.UInt16)
>>> b = na.zeros((3,3),na.UInt16)
>>> na.concatenate((a,b))
[[0 0 0]
[0 0 0]
[0 0 0]
[0 0 0]
[0 0 0]
[0 0 0]]
>>> _.type()
UInt16
>>> na.array((a,b))
[[[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]]]
>>> _.type()
Int32
Thanks,
Sebastian Haase
More information about the NumPy-Discussion
mailing list