I'm trying to understand how a np.array can be created with shape(0,2).
Is this even possible?
So
np.array([]).shape
#output (0,)
np.array([[],[]]).shape
#output (2, 0)
can I get (0, 2) ?
(without using .T)
Use a function such as np.zeros. No need to worry about the value it generates since there are no values in a 0 x 2 array:
arr = np.zeros((0, 2))
arr.shape
(0, 2)
arr array([], shape=(0, 2), dtype=float64) does not use any nested brackets. It has an explicit shape instead.
np.array([[],[]]).T.shape?np.array([[],[]]).swapaxes(0,1)?