1.ValueError: only 2 non-keyword arguments accepted
解答:少写了外层的中括号group = array([1.0,1.1],[1.0,1.0],[0,0],[0,0.1])改成下面的样子就ok吧,我是这样解决的。
group = array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
2.AttributeError: 'dict' object has no attribute 'iteritems'
解答:Python3.5中:iteritems变为items
3.NameError: name 'reload' is not defined
解答:import importlib
importlib.reload(你需要导入的包)
4.TypeError: list indices must be integers or slices, not tuple
解答:当对数据集进行分割时候,对列表的索引方式写错了,注意看清列表维数,分号和逗号的差别。
5.NameError:name‘array’is not defined
解答:在书中所给代码前加 from numpy import *
6.TypeError: 'tuple' object is not callable
在python中,只有函数才是Callable(可Call的对象才是Callable)。但是tuple是一个数据类型,当然是不能Call(翻译成:使唤,hhh可能会比较容易理解)
区别是()和[]
错误代码:m = dataSet.shape(0)
正确代码:m = dataSet.shape[0]
7.
Python3将raw_input和input进行整合成了input....去除了raw_input()函数....
其接受任意输入, 将所有输入默认为字符串处理,并返回字符串类型