I think you have one of the below problem.
Problem 1 :- you have 2D array and wants to have few small X_trains out of it. check below code and output for this.
CODE
import numpy as np
X_train = np.random.randint(5, size=(10,3)) #### here you'll have your 2D array
count=1
X_train_change={}
number_of_xtrain=5 ### number of chunk of X_train
for i in range(number_of_xtrain):
shp=np.random.randint(np.size(A,0))
#print(A[shp,:])
X_train_change['X_Train%s'%count]=A[shp,:]
count+=1
print(X_train_change)
Output
{'X_Train1': array([4, 1, 4]), 'X_Train2': array([3, 1, 1]), 'X_Train3': array([3, 1, 1]), 'X_Train4': array([4, 1, 4]), 'X_Train5': array([3, 4, 2])}
Problem 2 :- you have 1D array like this [1,2,3,4,5,6,7,8,9,10] and you want to have small xtrains like this X_Train1=[1,2,3,4,] , X_train2=[5,6,7,8,9,10]. check below code for this.
CODE
import numpy as np
X_train = np.random.randint(5, size=(400)) ### make sure to have size which can be splitted in number columns (length should be directly divided by number of columns you want)
print(X_train)
print(X_train.reshape(-1,40))
Output
[[4 3 1 2 1 3 3 3 0 3 1 1 0 3 4 4 3 4 3 0 2 1 2 1 1 1 0 4 4 4 0 0 1 4 4 1
1 1 1 4]
[4 1 1 0 1 2 2 0 2 3 0 3 4 2 0 4 2 3 1 4 4 4 2 0 1 3 1 3 2 1 4 2 2 2 3 3
1 1 4 4]
[1 3 0 0 0 2 0 4 0 0 2 1 3 3 2 4 0 1 0 0 3 2 1 4 4 1 4 1 3 2 2 0 2 4 0 2
3 4 4 4]
[0 3 1 2 0 1 0 0 0 1 0 2 4 3 1 2 2 3 4 0 3 4 4 2 4 1 2 0 4 4 2 3 2 2 2 2
4 0 3 3]
[0 1 4 3 1 2 3 1 4 0 0 3 4 4 2 2 0 0 0 1 3 2 4 4 0 2 3 1 0 0 1 3 4 4 3 1
1 0 0 2]
[4 2 1 2 3 1 1 3 2 1 1 2 3 3 2 0 1 0 1 3 0 1 2 3 1 3 3 1 2 4 2 1 4 2 1 3
3 4 3 4]
[4 3 4 1 1 0 4 1 4 2 0 4 3 1 2 4 0 1 3 3 2 1 3 0 4 3 1 1 1 3 2 1 4 0 2 0
0 4 3 2]
[0 1 0 4 2 4 1 1 4 0 1 2 4 1 4 1 2 3 4 4 4 2 1 3 2 3 1 4 4 4 2 2 0 4 1 0
0 0 4 2]
[0 0 2 4 4 4 2 4 4 1 1 1 2 0 1 1 4 1 0 0 3 0 4 3 1 3 4 2 0 4 4 3 1 0 4 1
0 3 0 1]
[2 1 4 4 2 2 1 1 4 0 1 1 2 1 1 1 0 4 0 4 1 4 4 0 4 3 4 2 4 4 1 1 2 0 3 2
3 2 1 1]]