热线电话:13121318867

登录
2020-05-13 阅读量: 1398
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')。

48.4871
5
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子