2020-10-13
阅读量:
1334
python报错:TypeError: ‘>’not supported between instances of str and int
问:
python报错:TypeError: ‘>’not supported between instances of str and int
答:
这是因为原数据中的年龄字段是字符型,字符型的字段无法与数值型的‘50’进行比较,
将年龄字段的数据类型改为数值型即可:df.年龄 = df.年龄.astype('int')。






评论(0)


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