python的ValueError: only 2 non-keyword arguments accepted

小虎输入下面代码就出问题了,原因是因为没有把矩阵建立格式分清楚。在矩阵组外,加上方框即可,详细见下。

源代码

import time
import numpy as np

A = np.array([56.0, 0.0, 4.4, 68.0],
             [1.2, 104.0, 52.0, 8.0],
             [1.8, 135.0, 99.0, 0.9])

cal=A.sum(axis=0)
print(cal)

修改后

import time
import numpy as np

A = np.array([[56.0, 0.0, 4.4, 68.0],
             [1.2, 104.0, 52.0, 8.0],
             [1.8, 135.0, 99.0, 0.9]])

cal=A.sum(axis=0)
print(cal)

在这里插入图片描述

参考资料

how to resolve this ValueError: only 2 non-keyword arguments accepted sklearn python

猜你喜欢

转载自blog.csdn.net/Davidietop/article/details/105848360