Split an array into multiple sub-arrays of equal size.
Parameters: | ary : ndarray
indices_or_sections : int or 1-D array
axis : int, optional
|
---|---|
Returns: | sub-arrays : list of ndarrays
|
Raises: | ValueError :
|
See also
Examples
>>> x = np.arange(9.0)
>>> np.split(x, 3)
[array([ 0., 1., 2.]), array([ 3., 4., 5.]), array([ 6., 7., 8.])]
>>> x = np.arange(8.0)
>>> np.split(x, [3, 5, 6, 10])
[array([ 0., 1., 2.]),
array([ 3., 4.]),
array([ 5.]),
array([ 6., 7.]),
array([], dtype=float64)]