import numpy as np
n = 2
X = np.empty(shape=[0, n])
for i in range(5):
for j in range(2):
X = np.append(X, [[i, j]], axis=0)
print X
arr = np.array([])
np.empty(shape=[0,0])
array([], shape=(0, 0), dtype=float64)
>>> np.empty([2, 2])
array([[ -9.74499359e+001, 6.69583040e-309],
[ 2.13182611e-314, 3.06959433e-309]]) #uninitialized
>>> np.empty([2, 2])
#Output:
array([[ -9.74499359e+001, 6.69583040e-309],
[ 2.13182611e-314, 3.06959433e-309]])
# Create an empty array with 2 elements
np.empty(2)
array([ 3.14, 42. ]) # may vary
array = []
import numpy as np
b = np.empty(2, dtype = int)
print("Matrix b :
", b)
a = np.empty([2, 2], dtype = int)
print("
Matrix a :
", a)
c = np.empty([3, 3])
print("
Matrix c :
", c)
np.empty([2, 2])
array([[ -9.74499359e+001, 6.69583040e-309],
[ 2.13182611e-314, 3.06959433e-309]]) #uninitialized