I have a vector and want to reshape it into a matrix, but the lenghts don't match. I want the remaining spots in the matrix to be filled with nan
import numpy
vec = np.arange(7, dtype=float)
mat = np.reshape(vec,(3,3)) # not working since vector too short
desired output:
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., nan, nan]])
How can I achieve the array without manually extending the vector?