Arrays can also be split into multiple arrays along the horizontal, vertical, and depth axes using the
np.dsplit() functions. We will only look at the
np.hsplit() function as the others work similarly.
np.hsplit() function takes the array to split as a parameter, and either a scalar value to specify the number of arrays to be returned, or a list of column indexes to split the array upon.
If splitting into a number of arrays, each array returned will have the same count of columns. The source array must have a number of columns that is a multiple of the specified value.
To demonstrate this, we will use the following array with four columns and three rows:
In : # sample array a = np.arange(12).reshape(3, ...