From ab12dc87f4717fc0fdeca314cd32cd5924928595 Mon Sep 17 00:00:00 2001 From: daaawx Date: Tue, 22 Dec 2020 15:46:24 +0100 Subject: DOC: Update examples in stack docstrings (#18054) The numbers chosen in the stacking examples can make them difficult to interpret. I suggest using different numbers to make it unambiguous. --- numpy/core/shape_base.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'numpy/core/shape_base.py') diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py index e4dc30d4c..e90358ba5 100644 --- a/numpy/core/shape_base.py +++ b/numpy/core/shape_base.py @@ -258,20 +258,20 @@ def vstack(tup): Examples -------- >>> a = np.array([1, 2, 3]) - >>> b = np.array([2, 3, 4]) + >>> b = np.array([4, 5, 6]) >>> np.vstack((a,b)) array([[1, 2, 3], - [2, 3, 4]]) + [4, 5, 6]]) >>> a = np.array([[1], [2], [3]]) - >>> b = np.array([[2], [3], [4]]) + >>> b = np.array([[4], [5], [6]]) >>> np.vstack((a,b)) array([[1], [2], [3], - [2], - [3], - [4]]) + [4], + [5], + [6]]) """ if not overrides.ARRAY_FUNCTION_ENABLED: @@ -321,15 +321,15 @@ def hstack(tup): Examples -------- >>> a = np.array((1,2,3)) - >>> b = np.array((2,3,4)) + >>> b = np.array((4,5,6)) >>> np.hstack((a,b)) - array([1, 2, 3, 2, 3, 4]) + array([1, 2, 3, 4, 5, 6]) >>> a = np.array([[1],[2],[3]]) - >>> b = np.array([[2],[3],[4]]) + >>> b = np.array([[4],[5],[6]]) >>> np.hstack((a,b)) - array([[1, 2], - [2, 3], - [3, 4]]) + array([[1, 4], + [2, 5], + [3, 6]]) """ if not overrides.ARRAY_FUNCTION_ENABLED: @@ -403,15 +403,15 @@ def stack(arrays, axis=0, out=None): (3, 4, 10) >>> a = np.array([1, 2, 3]) - >>> b = np.array([2, 3, 4]) + >>> b = np.array([4, 5, 6]) >>> np.stack((a, b)) array([[1, 2, 3], - [2, 3, 4]]) + [4, 5, 6]]) >>> np.stack((a, b), axis=-1) - array([[1, 2], - [2, 3], - [3, 4]]) + array([[1, 4], + [2, 5], + [3, 6]]) """ if not overrides.ARRAY_FUNCTION_ENABLED: @@ -786,9 +786,9 @@ def block(arrays): array([1, 2, 3]) >>> a = np.array([1, 2, 3]) - >>> b = np.array([2, 3, 4]) + >>> b = np.array([4, 5, 6]) >>> np.block([a, b, 10]) # hstack([a, b, 10]) - array([ 1, 2, 3, 2, 3, 4, 10]) + array([ 1, 2, 3, 4, 5, 6, 10]) >>> A = np.ones((2, 2), int) >>> B = 2 * A @@ -799,10 +799,10 @@ def block(arrays): With a list of depth 2, `block` can be used in place of `vstack`: >>> a = np.array([1, 2, 3]) - >>> b = np.array([2, 3, 4]) + >>> b = np.array([4, 5, 6]) >>> np.block([[a], [b]]) # vstack([a, b]) array([[1, 2, 3], - [2, 3, 4]]) + [4, 5, 6]]) >>> A = np.ones((2, 2), int) >>> B = 2 * A -- cgit v1.2.1