美文网首页
slice indices must be integers o

slice indices must be integers o

作者: miniminiming | 来源:发表于2018-07-03 11:16 被阅读0次

slice indices must be integers or None or have an index method

刚开始的写法

cleaned_data = cleaned_data[0:len(cleaned_data)*0.9]

错误原因是浮点数不能当数组或者元组的下标

正确写法,转成int就可以了,试过用round替换int但是也没起作用

cleaned_data = cleaned_data[0:int(len(cleaned_data)*0.9)]

相关文章

网友评论

      本文标题:slice indices must be integers o

      本文链接:https://www.haomeiwen.com/subject/kveduftx.html