[Numpy-discussion] numpy.array() of mixed integers and strings can truncate data

Charles R Harris charlesr.harris at gmail.com
Thu Dec 1 11:39:51 EST 2011


On Thu, Dec 1, 2011 at 6:52 AM, Thouis (Ray) Jones <thouis at gmail.com> wrote:

> Is this expected behavior?
>
> >>> np.array([-345,4,2,'ABC'])
> array(['-34', '4', '2', 'ABC'], dtype='|S3')
>
>
>
Given that strings should be the result, this looks like a bug. It's a bit
of a corner case that probably slipped through during the recent work on
casting. There needs to be tests for these sorts of things, so if you find
more oddities post them so we can add them.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111201/689817df/attachment.html>


More information about the NumPy-Discussion mailing list