I have read a code is like this
x = np.linspace(0, 100, 10)[:, None]
I know the meaning of np.linspace(0,100,10)
But I don't know what does '[:,None]' mean
The [:, None]
adds an extra axis making a two-dimensional the array of shape (10, 1)
. A more explicit version would be:
x = np.linspace(0, 100, 10)[:, np.newaxis]