diff options
author | Miki Watanabe <105326591+MikiPWata@users.noreply.github.com> | 2022-11-16 10:08:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-15 17:08:18 -0800 |
commit | cf59f6c2dad8acb8c4f6d18f6089b0faa2added8 (patch) | |
tree | 8276807e101f7d21a9152ddbbc07ccb38475373c /numpy/lib/arraypad.py | |
parent | a7abbeec3f1f974c249a7aa6802debebead0b385 (diff) | |
download | numpy-cf59f6c2dad8acb8c4f6d18f6089b0faa2added8.tar.gz |
DOC: Update parameter descriptions for np.pad (#22519)
Some parameters like pad_width or stat_length claimed to expect tuples-of-tuples as
input, but in practice they also work with single tuples. The parameter descriptions of the
relevant parameters are updated in the docstring to reflect this implicit tuple wrapping
behavior.
Co-authored-by: 渡邉 美希 <miki.watanabe@watanabenoMacBook-Pro.local>
Diffstat (limited to 'numpy/lib/arraypad.py')
-rw-r--r-- | numpy/lib/arraypad.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/numpy/lib/arraypad.py b/numpy/lib/arraypad.py index 8830b8147..28123246d 100644 --- a/numpy/lib/arraypad.py +++ b/numpy/lib/arraypad.py @@ -537,11 +537,12 @@ def pad(array, pad_width, mode='constant', **kwargs): The array to pad. pad_width : {sequence, array_like, int} Number of values padded to the edges of each axis. - ((before_1, after_1), ... (before_N, after_N)) unique pad widths + ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths for each axis. - ((before, after),) yields same before and after pad for each axis. - (pad,) or int is a shortcut for before = after = pad width for all - axes. + ``(before, after)`` or ``((before, after),)`` yields same before + and after pad for each axis. + ``(pad,)`` or ``int`` is a shortcut for before = after = pad width + for all axes. mode : str or function, optional One of the following string values or a user supplied function. @@ -586,14 +587,14 @@ def pad(array, pad_width, mode='constant', **kwargs): Used in 'maximum', 'mean', 'median', and 'minimum'. Number of values at edge of each axis used to calculate the statistic value. - ((before_1, after_1), ... (before_N, after_N)) unique statistic + ``((before_1, after_1), ... (before_N, after_N))`` unique statistic lengths for each axis. - ((before, after),) yields same before and after statistic lengths - for each axis. + ``(before, after)`` or ``((before, after),)`` yields same before + and after statistic lengths for each axis. - (stat_length,) or int is a shortcut for before = after = statistic - length for all axes. + ``(stat_length,)`` or ``int`` is a shortcut for + ``before = after = statistic`` length for all axes. Default is ``None``, to use the entire axis. constant_values : sequence or scalar, optional @@ -603,11 +604,11 @@ def pad(array, pad_width, mode='constant', **kwargs): ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants for each axis. - ``((before, after),)`` yields same before and after constants for each - axis. + ``(before, after)`` or ``((before, after),)`` yields same before + and after constants for each axis. - ``(constant,)`` or ``constant`` is a shortcut for ``before = after = constant`` for - all axes. + ``(constant,)`` or ``constant`` is a shortcut for + ``before = after = constant`` for all axes. Default is 0. end_values : sequence or scalar, optional @@ -617,11 +618,11 @@ def pad(array, pad_width, mode='constant', **kwargs): ``((before_1, after_1), ... (before_N, after_N))`` unique end values for each axis. - ``((before, after),)`` yields same before and after end values for each - axis. + ``(before, after)`` or ``((before, after),)`` yields same before + and after end values for each axis. - ``(constant,)`` or ``constant`` is a shortcut for ``before = after = constant`` for - all axes. + ``(constant,)`` or ``constant`` is a shortcut for + ``before = after = constant`` for all axes. Default is 0. reflect_type : {'even', 'odd'}, optional |