Split array into multiple sub-arrays along the 3rd axis (depth).
Parameters: | ary : ndarray
indices_or_sections: integer or 1D array :
axis : integer, optional
|
---|---|
Returns: | sub-arrays : list
|
See also
Notes
dsplit requires that sub-arrays are of equal shape, whereas array_split allows for sub-arrays to have nearly-equal shape. Equivalent to split with axis = 2.
Examples
>>> x = np.arange(16.0).reshape(2, 2, 4)
>>> np.dsplit(x, 2)
<BLANKLINE>
[array([[[ 0., 1.],
[ 4., 5.]],
<BLANKLINE>
[[ 8., 9.],
[ 12., 13.]]]),
array([[[ 2., 3.],
[ 6., 7.]],
<BLANKLINE>
[[ 10., 11.],
[ 14., 15.]]])]
<BLANKLINE>
>>> x = np.arange(16.0).reshape(2, 2, 4)
>>> np.dsplit(x, array([3, 6]))
<BLANKLINE>
[array([[[ 0., 1., 2.],
[ 4., 5., 6.]],
<BLANKLINE>
[[ 8., 9., 10.],
[ 12., 13., 14.]]]),
array([[[ 3.],
[ 7.]],
<BLANKLINE>
[[ 11.],
[ 15.]]]),
array([], dtype=float64)]