Note that there was little information about Python's numpy.newaxis. The purpose is conversion to vertical vector. According to NumPy's Reference, it seems to be an alias for None, but I'm not sure why adding None to a slice increases the dimension. There wasn't.
import numpy as np
a = np.array([1,2,3,4,5])
b = a[:,np.newaxis]
print b # array([[1],[2],[3],[4],[5]])Outputs
c = a[:,None]
print c # array([[1],[2],[3],[4],[5]])Outputs
Recommended Posts