NumPy Depth-Wise Splitting: numpy.dsplit() function

It is used to split an array into multiple sub-arrays along the 3rd axis i.e. dsplit() only works on arrays of 3-D or more dimensions.

Syntax:

numpy.dsplit(array, sections)

Example:

import numpy as np
a=np.array([[[1,2,3],[4,5,6]],[[11,12,13],[14,15,16]]])
b=np.dsplit(a,3)
print(b)

Output:

[array([[[ 1],
        [ 4]],

       [[11],
        [14]]]), array([[[ 2],
        [ 5]],

       [[12],
        [15]]]), array([[[ 3],
        [ 6]],

       [[13],
        [16]]])]
Tue, 09/07/2021 - 19:00

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.