[Numpy-discussion] subtypes of ndarray and round()

Ralf Gommers ralf.gommers at gmail.com
Sat Jul 20 06:58:08 EDT 2013


On Thu, Jul 4, 2013 at 9:43 PM, Matti Picus <matti.picus at gmail.com> wrote:

> round() does not consistently preserve subtype of the ndarray,
> is this known behaviour or should I file a bug for it?
>

That looks like a bug to me. The docstring explicitly says that return type
equals input type.

Ralf



> Python 2.7.3 (default, Sep 26 2012, 21:51:14)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import numpy as np
>  >>> np.version.version
> '1.7.0'
>  >>> a=np.matrix(range(10))
>  >>> a.round(decimals=10)
> matrix([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])
>  >>> a.round(decimals=-10)
> array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
>
> Matti
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130720/9db890f6/attachment.html>


More information about the NumPy-Discussion mailing list