summaryrefslogtreecommitdiff
path: root/numpy/core/shape_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/shape_base.py')
-rw-r--r--numpy/core/shape_base.py47
1 files changed, 23 insertions, 24 deletions
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index e4dc30d4c..a81a04f7f 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -8,8 +8,7 @@ import warnings
from . import numeric as _nx
from . import overrides
-from ._asarray import array, asanyarray
-from .multiarray import normalize_axis_index
+from .multiarray import array, asanyarray, normalize_axis_index
from . import fromnumeric as _from_nx
@@ -258,20 +257,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 +320,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 +402,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:
@@ -607,7 +606,7 @@ def _block_info_recursion(arrays, max_depth, result_ndim, depth=0):
The arrays to check
max_depth : list of int
The number of nested lists
- result_ndim: int
+ result_ndim : int
The number of dimensions in thefinal array.
Returns
@@ -786,9 +785,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 +798,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