[Numpy-discussion] Summing an array with dtype=object
Pierre GM
pgmdevlist at gmail.com
Mon Nov 16 00:11:43 EST 2009
All,
An issue was recently raised about summing a MaskedArray with a np.object dtype. Turns out that the problem is numpy based:
Let's sum using integers
>>> type(np.sum([1,2,3], dtype=np.int32))
<type 'numpy.int32'>
Now, with a np.object dtype:
>>> type(np.sum([1,2,3],dtype=object))
<type 'int'>
And we no longer have a np.object, but a regular Python int. Which, unfortunately for MaskedArray, does not have a view object (hence the bug).
Is it the expected behavior ?
More information about the NumPy-Discussion
mailing list