I want to split an array of 14 elements into 4 equal elements.
For example The input array:my_array[1,2,3,4,5,6,7,8,9,10,11,12,13,14]
I want to split array my_array like this: my_array[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,7],......,[11,12,13,14]
Can any of you explain how to do this? (I am working on python using numpy, also It would be nice if your answers are related to numpy.)
I tried basic split functions on numpy.
import numpy as np
my_array = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14]
np.array_split(my_array,4)
[array([1, 2, 3, 4]),
array([5, 6, 7, 8]),
array([ 9, 10, 11]),
array([12, 13, 14])]