I want to split my numpy array into separate arrays. The separation must be based on the index. The split count is given by the user.
For example,
The input array: my_array=[1,2,3,4,5,6,7,8,9,10]
If user gives split count =2, then, the split must be like
my_array1=[1,3,5,7,9]
my_array2=[2,4,6,8,10]
if user gives split count=3, then the output array must be
my_array1=[1,4,7,10]
my_array2=[2,5,8]
my_array3=[3,6,9]
could anyone please explain, I did for split count 2 using even odd concept
for i in range(len(outputarray)):
if i%2==0:
even_array.append(outputarray[i])
else:
odd_array.append(outputarray[i])
I don't know how to do the split for variable counts like 3,4,5 based on the index.