summaryrefslogtreecommitdiff
path: root/numpy/core/shape_base.py
diff options
context:
space:
mode:
authorAllan Haldane <ealloc@gmail.com>2017-09-18 04:02:36 +0200
committerGitHub <noreply@github.com>2017-09-18 04:02:36 +0200
commit2d7352a7eefe37a102124c110770b1aa2235e853 (patch)
treefe0de29bebff22a317895a7ff47385f25a974cf9 /numpy/core/shape_base.py
parent8927415381c00ac5bf7aea5f473ce64a694170d8 (diff)
parent83ed2caff9a61bf8406e3ebb871ff8a62bf02d40 (diff)
downloadnumpy-2d7352a7eefe37a102124c110770b1aa2235e853.tar.gz
Merge pull request #9209 from eric-wieser/concatenate-out
ENH: Add an out argument to concatenate
Diffstat (limited to 'numpy/core/shape_base.py')
-rw-r--r--numpy/core/shape_base.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index f1847d7e3..026ad603a 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -293,7 +293,7 @@ def hstack(tup):
return _nx.concatenate(arrs, 1)
-def stack(arrays, axis=0):
+def stack(arrays, axis=0, out=None):
"""
Join a sequence of arrays along a new axis.
@@ -309,6 +309,10 @@ def stack(arrays, axis=0):
Each array must have the same shape.
axis : int, optional
The axis in the result array along which the input arrays are stacked.
+ out : ndarray, optional
+ If provided, the destination to place the result. The shape must be
+ correct, matching that of what stack would have returned if no
+ out argument were specified.
Returns
-------
@@ -358,7 +362,7 @@ def stack(arrays, axis=0):
sl = (slice(None),) * axis + (_nx.newaxis,)
expanded_arrays = [arr[sl] for arr in arrays]
- return _nx.concatenate(expanded_arrays, axis=axis)
+ return _nx.concatenate(expanded_arrays, axis=axis, out=out)
class _Recurser(object):