UnicodeDecodeError:'utf8'编解码器无法解码位置11的字节0xab:无效的起始字节

时间:2019-02-11 21:32:44

标签: python numpy

我正在尝试读取此xlsx文件

tran=np.loadtxt("s.xlsx",delimiter=",")
x_train=tran[:,1:45]
y_train=tran[:,45]
test=np.loadtxt("s.xlsx",delimiter=",")
x_test=test[:,45]
y_test=test[:,:]

Traceback (most recent call last):
  File "Example_1.py", line 11, in <module>
    tran=np.loadtxt("s.xlsx",delimiter=",")
  File "/home/siddharth/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 1086, in loadtxt
    first_line = next(fh)
  File "/usr/lib/python2.7/codecs.py", line 314, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xab in position 11: invalid start byte

但是当我尝试运行程序时,出现此错误

0 个答案:

没有答案