[SciPy-User] On numpy.pad(array, pad_width, mode, **kwargs)

Virgil Stokes vs at it.uu.se
Tue Mar 5 18:50:05 EST 2019


One mode of padding is 'mean'.  However, it does not return the actual mean of the array --- it returns the rounded value of the mean!

example:

    a = np.array([1, 2, -1, 4, -3])
  np.mean(a) =  0.6
  np.pad(a, (2,), 'mean') = [ 1  1  1  2 -1  4 -3  1  1]

The documentation that I found at: https://docs.scipy.org/doc/numpy/reference/generated/numpy.pad.html
shows:

‘mean’ - Pads with the mean value of all or part of the vector along each axis.

It actually Pads with the rounded mean value. IMHO it should return the "float_" value. If the SciPy team does not agree, then the documentation should be changed to show what it actually returns.

--V




IMHO it should








När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-user/attachments/20190306/8ace77a3/attachment.html>


More information about the SciPy-User mailing list