numpy库中reshape函数参数为-1的含义

>>> import numpy as np
>>> c = np.array([1,2,3,4,5,6])
>>> c
array([1, 2, 3, 4, 5, 6])
>>> c = c.reshape(3,-1)
>>> c
array([[1, 2],
       [3, 4],
       [5, 6]])

-1的含义为根据行(或列)自动计算列(或行)的大小

你可能感兴趣的:(python)