2021-04-06
閱讀量:
526
python報(bào)錯(cuò):TypeError: ‘>’not supported between instances of str and int
問:
python報(bào)錯(cuò):TypeError: ‘>’not supported between instances of str and int
答:
這是因?yàn)樵瓟?shù)據(jù)中的年齡字段是字符型,字符型的字段無法與數(shù)值型的‘50’進(jìn)行比較,
將年齡字段的數(shù)據(jù)類型改為數(shù)值型即可:df.年齡 = df.年齡.astype('int')。






評論(0)


暫無數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評論
0條評論
0條評論