One approach would be to get places of shifts where numbers change and use these indices to split the input array into subarrays. To find these indices, you can use np.nonzero for a differentiated array, and then use np.split to split, for example:
np.split(a,np.nonzero(np.diff(a))[0]+1)
Run Example -
In [42]: a Out[42]: array([2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6]) In [43]: np.split(a,np.nonzero(np.diff(a))[0]+1) Out[43]: [array([2, 2, 2, 2]), array([3, 3, 3, 3]), array([4, 4, 4, 4, 4, 4, 4]), array([5, 5]), array([6, 6, 6])]