有负数,有些单元格只包含-
。导入数据时它们就在那里。如何从数据框中删除它们?基本上这是一个缺失值的符号。
答案 0 :(得分:0)
例如,你有一个df
df = pd.DataFrame(dict(A=[2,2,2,2,2,2,2], what=["what","what","what","-","what","-","what"]))
然后使用
df[df.what.str.contains("-") == False]
输出
A what
0 2 what
1 2 what
2 2 what
4 2 what
6 2 what