I am facing an abnormal behavior of numpy array, while trying to create numpy 2D array from some numpy array. Below is the sample code-
x = []
x.append(x1)
x.append(x2)
x.append(x3)
x = np.array(x)
print x1.shape, type(x1)
print x2.shape, type(x2)
print x3.shape, type(x3)
print x.shape, type(x)
print x[0].shape, type(x[0])
(1318,) <type 'numpy.ndarray'>
(1352,) <type 'numpy.ndarray'>
(1286,) <type 'numpy.ndarray'>
(3,) <type 'numpy.ndarray'>
(1318,) <type 'numpy.ndarray'>
I wasn't expecting for this output. Hence I tired another code, which looks like below-
x1 = np.arange(4)
x2 = np.arange(4,8)
x3 = np.arange(8,12)
x.append(x1)
x.append(x2)
x.append(x3)
x = np.array(x)
print x.shape
(3, 4)
Why, I am not seeing 2d array in first case?