Skip to content Skip to sidebar Skip to footer

Size Of A Linspace Output

If I execute the code below x = np.linspace(1, 12, 5) and if I display I get a result as array([ 1. , 3.75, 6.5 , 9.25, 12. ]) and if I do a shape() function on x then

Solution 1:

The display does not represent whether it is columns or rows in the way that Matlab does (if that is what you were drawing your idea from).

To understand this try the following:

import numpy as np
x = np.linspace(1, 12, 5)
x_new = np.expand_dims(x, axis=0)
print(np.shape(x_new))
print(x_new)

Post a Comment for "Size Of A Linspace Output"