diff options
author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2022-02-11 14:41:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 14:41:30 +0100 |
commit | 902afdb7a8a821e7103ad329a08e11c3670f7864 (patch) | |
tree | 2ede62b69ffecacaab13b4adbb79b8c3dbbe8fac /numpy/core/numeric.py | |
parent | a2d91e6f5b3b2e192ae741798844e306a7854e85 (diff) | |
parent | 2bb9f38d1e982f9797b2a231828b4b39fcc954d3 (diff) | |
download | numpy-902afdb7a8a821e7103ad329a08e11c3670f7864.tar.gz |
Merge pull request #21030 from lorenzomammana/fix-full-like-documentation
DOC: change fill_value of full_like from scalar to array_like
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 3e9b6c414..2c5265709 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -364,7 +364,7 @@ def full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None): a : array_like The shape and data-type of `a` define these same attributes of the returned array. - fill_value : scalar + fill_value : array_like Fill value. dtype : data-type, optional Overrides the data type of the result. @@ -412,6 +412,12 @@ def full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None): >>> np.full_like(y, 0.1) array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) + >>> y = np.zeros([2, 2, 3], dtype=int) + >>> np.full_like(y, [0, 0, 255]) + array([[[ 0, 0, 255], + [ 0, 0, 255]], + [[ 0, 0, 255], + [ 0, 0, 255]]]) """ res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape) multiarray.copyto(res, fill_value, casting='unsafe') |