How do you delete rows with a certain object in pandas, python?

后端 未结 2 2055
陌清茗
陌清茗 2021-01-29 11:39

I have a column in my data that contains these kind of values

2

2

yes

2

yes

In python pandas how would I identify the entire row

2条回答
  •  耶瑟儿~
    2021-01-29 12:01

    IIUC:

    df = df[~pd.to_numeric(df['col'], errors='coerce').isna()]
    

    or

    df = df[pd.to_numeric(df['col'], errors='coerce').notna()]
    

提交回复
热议问题