鍍金池/ 問答/數(shù)據(jù)分析&挖掘  PHP  Python/ pandas如何清洗某列中值為字符串的數(shù)據(jù)元?

pandas如何清洗某列中值為字符串的數(shù)據(jù)元?

clipboard.png圖中值為“通過”

pandas讀取csv文件之后,我想把‘kscj’列中值是字符串的數(shù)據(jù)行刪除掉應該怎么弄?

回答
編輯回答
朽鹿
df["kscj"] = df["kscj"].astype(str)
result = df[df.kscj.str.isdigit()]
2017年9月1日 00:11