I have this NumPy array:
X = numpy.linspace(1, 10, 10)
I believe the output will become
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Why is the shape of this array (10,)
? I don't understand why it isn't (1,10)
.
I have this NumPy array:
X = numpy.linspace(1, 10, 10)
I believe the output will become
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Why is the shape of this array (10,)
? I don't understand why it isn't (1,10)
.
This is because you created a vector, and vectors are always in a single dimension.
If you want to have shape, (1,10) you can specifiy the shape using X.reshape((1,10))