Skip to content

Commit 6e34bf8

Browse files
authored
Merge pull request numpy#27364 from Kh4L/stack_doc_input_update
DOC: Update np.*stack doc to reflect behavior
2 parents 56bba7c + a861266 commit 6e34bf8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

numpy/_core/shape_base.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ def vstack(tup, *, dtype=None, casting="same_kind"):
235235
----------
236236
tup : sequence of ndarrays
237237
The arrays must have the same shape along all but the first axis.
238-
1-D arrays must have the same length.
238+
1-D arrays must have the same length. In the case of a single
239+
array_like input, it will be treated as a sequence of arrays; i.e.,
240+
each element along the zeroth axis is treated as a separate array.
239241
240242
dtype : str or dtype
241243
If provided, the destination array will have this dtype. Cannot be
@@ -308,7 +310,9 @@ def hstack(tup, *, dtype=None, casting="same_kind"):
308310
----------
309311
tup : sequence of ndarrays
310312
The arrays must have the same shape along all but the second axis,
311-
except 1-D arrays which can be any length.
313+
except 1-D arrays which can be any length. In the case of a single
314+
array_like input, it will be treated as a sequence of arrays; i.e.,
315+
each element along the zeroth axis is treated as a separate array.
312316
313317
dtype : str or dtype
314318
If provided, the destination array will have this dtype. Cannot be
@@ -384,8 +388,10 @@ def stack(arrays, axis=0, out=None, *, dtype=None, casting="same_kind"):
384388
385389
Parameters
386390
----------
387-
arrays : sequence of array_like
388-
Each array must have the same shape.
391+
arrays : sequence of ndarrays
392+
Each array must have the same shape. In the case of a single ndarray
393+
array_like input, it will be treated as a sequence of arrays; i.e.,
394+
each element along the zeroth axis is treated as a separate array.
389395
390396
axis : int, optional
391397
The axis in the result array along which the input arrays are stacked.

0 commit comments

Comments
 (0)