edition :
numpy=1.19.3
python=3.6
Code :
import numpy as np
a = np.array([[12],[26],[40],[66]])
print(a.shape)
result:
(4, 1)
take (4,1) To (4,)
a_post_1 = np.squeeze(a)
print(a_post_1.shape)
result:
(4,)
Code :
import numpy as np
b = np.array([12,26,40,66])
print(b.shape)
result:
(4,)
take (4,) To (4,1)
b_post_1 = b.reshape(-1,1)
print(b_post_1.shape)
perhaps
b_post_2 = np.reshape(b,(-1,1))
print(b_post_2.shape)
result:
(4, 1)
(4, 1)
Reference resources :https://blog.csdn.net/zkp_987/article/details/119989767