1import numpy as np
2
3n = 2
4X = np.empty(shape=[0, n])
5
6for i in range(5):
7 for j in range(2):
8 X = np.append(X, [[i, j]], axis=0)
9
10print X
11
1>>> np.empty([2, 2])
2array([[ -9.74499359e+001, 6.69583040e-309],
3 [ 2.13182611e-314, 3.06959433e-309]]) #uninitialized
4
1>>> np.empty([2, 2])
2#Output:
3array([[ -9.74499359e+001, 6.69583040e-309],
4 [ 2.13182611e-314, 3.06959433e-309]])
5