MCPcopy Create free account
hub / github.com/numpy/numpy / concatenate

Function concatenate

numpy/core/multiarray.py:154–251  ·  view source on GitHub ↗

concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") Join a sequence of arrays along an existing axis. Parameters ---------- a1, a2, ... : sequence of array_like The arrays must have the same shape, except in the dimension corresponding

(arrays, axis=None, out=None, *, dtype=None, casting=None)

Source from the content-addressed store, hash-verified

152
153@array_function_from_c_func_and_dispatcher(_multiarray_umath.concatenate)
154def concatenate(arrays, axis=None, out=None, *, dtype=None, casting=None):
155 """
156 concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind")
157
158 Join a sequence of arrays along an existing axis.
159
160 Parameters
161 ----------
162 a1, a2, ... : sequence of array_like
163 The arrays must have the same shape, except in the dimension
164 corresponding to `axis` (the first, by default).
165 axis : int, optional
166 The axis along which the arrays will be joined. If axis is None,
167 arrays are flattened before use. Default is 0.
168 out : ndarray, optional
169 If provided, the destination to place the result. The shape must be
170 correct, matching that of what concatenate would have returned if no
171 out argument were specified.
172 dtype : str or dtype
173 If provided, the destination array will have this dtype. Cannot be
174 provided together with `out`.
175
176 .. versionadded:: 1.20.0
177
178 casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
179 Controls what kind of data casting may occur. Defaults to 'same_kind'.
180
181 .. versionadded:: 1.20.0
182
183 Returns
184 -------
185 res : ndarray
186 The concatenated array.
187
188 See Also
189 --------
190 ma.concatenate : Concatenate function that preserves input masks.
191 array_split : Split an array into multiple sub-arrays of equal or
192 near-equal size.
193 split : Split array into a list of multiple sub-arrays of equal size.
194 hsplit : Split array into multiple sub-arrays horizontally (column wise).
195 vsplit : Split array into multiple sub-arrays vertically (row wise).
196 dsplit : Split array into multiple sub-arrays along the 3rd axis (depth).
197 stack : Stack a sequence of arrays along a new axis.
198 block : Assemble arrays from blocks.
199 hstack : Stack arrays in sequence horizontally (column wise).
200 vstack : Stack arrays in sequence vertically (row wise).
201 dstack : Stack arrays in sequence depth wise (along third dimension).
202 column_stack : Stack 1-D arrays as columns into a 2-D array.
203
204 Notes
205 -----
206 When one or more of the arrays to be concatenated is a MaskedArray,
207 this function will return a MaskedArray object instead of an ndarray,
208 but the input masks are *not* preserved. In cases where a MaskedArray
209 is expected as input, use the ma.concatenate function from the masked
210 array module instead.
211

Callers 5

test_concatenateMethod · 0.90
test_bad_out_shapeMethod · 0.90
test_out_and_dtypeMethod · 0.90
_leading_trailingFunction · 0.70
resizeFunction · 0.70

Calls

no outgoing calls

Tested by 3

test_concatenateMethod · 0.72
test_bad_out_shapeMethod · 0.72
test_out_and_dtypeMethod · 0.72