Let Y be a list of 100 ndarrays, such that Y[i] is an ndarray of an image, its shape is 160x320x3.
I want X no be an ndarrays that contains all the images, I do as follows:
x = [ y[i] for i in range(0,10) ]
np.array(Y)) should turn the list of ndarrays into one ndarray, with the size of the first axis corresponding to the length of the list.
>>> x = np.array([[1,2], [3,4]]) >>> c = [x,x] # list of 2x2 arrays >>> c [array([[1, 2], [3, 4]]), array([[1, 2], [3, 4]])] >>> np.array(c) # 2x2x2 array array([[[1, 2], [3, 4]], [[1, 2], [3, 4]]])
x if you only want a slice of