@@ -183,23 +183,25 @@ def vstack(tup):
183
183
"""
184
184
Stack arrays in sequence vertically (row wise).
185
185
186
- Take a sequence of arrays and stack them vertically to make a single
187
- array. Rebuild arrays divided by `vsplit`.
186
+ This is equivalent to concatenation along the first axis after 1-D arrays
187
+ of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by
188
+ `vsplit`.
188
189
189
- This function continues to be supported for backward compatibility, but
190
- you should prefer ``np.concatenate`` or ``np.stack``. The ``np.stack``
191
- function was added in NumPy 1.10.
190
+ This function makes most sense for arrays with up to 3 dimensions. For
191
+ instance, for pixel-data with a height (first axis), width (second axis),
192
+ and r/g/b channels (third axis). The functions `concatenate`, `stack` and
193
+ `block` provide more general stacking and concatenation operations.
192
194
193
195
Parameters
194
196
----------
195
197
tup : sequence of ndarrays
196
- Tuple containing arrays to be stacked. The arrays must have the same
197
- shape along all but the first axis .
198
+ The arrays must have the same shape along all but the first axis.
199
+ 1-D arrays must have the same length .
198
200
199
201
Returns
200
202
-------
201
203
stacked : ndarray
202
- The array formed by stacking the given arrays.
204
+ The array formed by stacking the given arrays, will be at least 2-D .
203
205
204
206
See Also
205
207
--------
@@ -210,11 +212,6 @@ def vstack(tup):
210
212
vsplit : Split array into a list of multiple sub-arrays vertically.
211
213
block : Assemble arrays from blocks.
212
214
213
- Notes
214
- -----
215
- Equivalent to ``np.concatenate(tup, axis=0)`` if `tup` contains arrays that
216
- are at least 2-dimensional.
217
-
218
215
Examples
219
216
--------
220
217
>>> a = np.array([1, 2, 3])
@@ -240,17 +237,20 @@ def hstack(tup):
240
237
"""
241
238
Stack arrays in sequence horizontally (column wise).
242
239
243
- Take a sequence of arrays and stack them horizontally to make
244
- a single array. Rebuild arrays divided by `hsplit`.
240
+ This is equivalent to concatenation along the second axis, except for 1-D
241
+ arrays where it concatenates along the first axis. Rebuilds arrays divided
242
+ by `hsplit`.
245
243
246
- This function continues to be supported for backward compatibility, but
247
- you should prefer ``np.concatenate`` or ``np.stack``. The ``np.stack``
248
- function was added in NumPy 1.10.
244
+ This function makes most sense for arrays with up to 3 dimensions. For
245
+ instance, for pixel-data with a height (first axis), width (second axis),
246
+ and r/g/b channels (third axis). The functions `concatenate`, `stack` and
247
+ `block` provide more general stacking and concatenation operations.
249
248
250
249
Parameters
251
250
----------
252
251
tup : sequence of ndarrays
253
- All arrays must have the same shape along all but the second axis.
252
<
8000
span class="diff-text-marker">+ The arrays must have the same shape along all but the second axis,
253
+ except 1-D arrays which can be any length.
254
254
255
255
Returns
256
256
-------
@@ -266,11 +266,6 @@ def hstack(tup):
266
266
hsplit : Split array along second axis.
267
267
block : Assemble arrays from blocks.
268
268
269
- Notes
270
- -----
271
- Equivalent to ``np.concatenate(tup, axis=1)`` if `tup` contains arrays that
272
- are at least 2-dimensional.
273
-
274
269
Examples
275
270
--------
276
271
>>> a = np.array((1,2,3))
0 commit comments