使用.reshape(-1, 1)
,如:
In [1]: import numpy as np
In [2]: arr = np.array([1,2,3,4,5])
In [3]: arr.reshape(-1, 1)
Out[3]:
array([[1],
[2],
[3],
[4],
[5]])
In [4]:
使用.reshape(-1, 1)
,如:
In [1]: import numpy as np
In [2]: arr = np.array([1,2,3,4,5])
In [3]: arr.reshape(-1, 1)
Out[3]:
array([[1],
[2],
[3],
[4],
[5]])
In [4]: