Reshape vector of odd length to multi-dimensional array

>>> import numpy as np
>>> A = [i for i in range(1, 16)]
>>> np.array(A, ndmin=2)
array([[ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15]])

ndmin int, optional
Specifies the minimum number of dimensions that the resulting array should have. Ones will be pre-pended to the shape as needed to meet this requirement.

Does this do what you’re looking for?

julia> reshape(Vector(1:15), 1, :)
1×15 Matrix{Int64}:
 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15
3 Likes