1.UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0x9a in position 2: illegal multibyte sequence
解决:
这是因为python那里的读取方式是 gbk,但我们在windows运行的话,文件的默认编码方式是utf-8.
所以只需要在文件读取的地方,加上
encoding='utf-8'
2.TypeError: only integer scalar arrays can be converted to a scalar index
解决:
a[idx]
更改为
np.array(a)[idx]
3.ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
解决: