2021-01-31
阅读量:
818
python报错 :TypeError: unhashable type: 'slice'
问:
python报错 :TypeError: unhashable type: 'slice'
答:
这是因为数据框dataSet的索引格式不正确,没有dataSet[:,-1]这种用法
这里需要通过切片将数据框dataSet的前n-1列数据提取出来(n为列数),
可以用dataframe的显示索引或者隐式索引,其中显示索引方法为:
隐式索引的方法为:






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论