diff options
author | daaawx <daaawx@gmail.com> | 2020-12-22 15:46:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 14:46:24 +0000 |
commit | ab12dc87f4717fc0fdeca314cd32cd5924928595 (patch) | |
tree | bc48c602cb22759b96ba3fe8a072c95e865311e1 /numpy/core/shape_base.py | |
parent | 11cba18268c04d43a56cca3635e49fce1e3a759e (diff) | |
download | numpy-ab12dc87f4717fc0fdeca314cd32cd5924928595.tar.gz |
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.
Diffstat (limited to 'numpy/core/shape_base.py')
-rw-r--r-- | numpy/core/shape_base.py | 42 |
1 files changed, 21 insertions, 21 deletions
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 |