np.newaxis
Adds new dimension to the array.
a = np.array([1, 2])
a[np.newaxis].shape
# (1, 2)
The same can be done using None
. None
and np.newaxis
are same.
np.newaxis
Adds new dimension to the array.
a = np.array([1, 2])
a[np.newaxis].shape
# (1, 2)
The same can be done using None
. None
and np.newaxis
are same.