# Tensorflow how to make a training data

I'm a begginer in programming I beg your pardon for that question, I just want to learn.

The function

tf.keras.datasets.mnist.load_data()


returns

Tuple of Numpy arrays: (x_train, y_train), (x_test, y_test).


But I want a data set like this (x,y) with $$x$$ a data and $$y$$ a label. So this is my attempt :

import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
N = np.size(x_train)

training_data = []
for i in range(N):
training_data.append( (x_train[i], y_train[i]) )

n = np.size(x_test)
test_data =  np.zeros( (n,2) )
for i in range(n):
test_data[i] = (X_test[i],y_test[i])

net = Network([784, 30, 10])
net.SGD(training_data, 30, 10, 3.0, test_data=test_data)


And the error I get which i don't understand :

training_data.append( (x_train[i], y_train[i]) ) IndexError: index 60000 is out of bounds for axis 0 with size 60000


Thanks you for your help.

train_data = np.array(list(zip(x_train, y_train)))

Also, note that np.size gives you the overall number of elements (floating points) inside the multi-dimensional array, i.e. here $$60K\times28\times28$$, so you run out of indices.