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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

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

Virgil Stokes
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!


    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
‘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.


IMHO it should 
Page Title

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
SciPy-User mailing list
[hidden email]