如何删除 pandas 中带有特定对象的行,python? [英] How do you delete rows with a certain object in pandas, python?
本文介绍了如何删除 pandas 中带有特定对象的行,python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的数据中有一列包含此类值
I have a column in my data that contains these kind of values
2
2
是
2
是
在python pandas中,我如何识别包含一串字母的整个行,然后删除或删除整个行?
In python pandas how would I identify the entire row containing a string of letters and then delete or drop the entire row?
谢谢
推荐答案
IIUC:
df = df[~pd.to_numeric(df['col'], errors='coerce').isna()]
或
df = df[pd.to_numeric(df['col'], errors='coerce').notna()]
这篇关于如何删除 pandas 中带有特定对象的行,python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文