python - delete string in a pandas dataframe -
i have
df = pandasdataframe data.
i have second pandas-dataframe (called df_outlier) keys (that exist in df) , want remove them df.
df_outlier
i looking following function - might not right approach. key contains alphanumeric values - letters , numbers. not int.
clean_df = (df['id'] - df_outlier['id'])
any ideas? thanks.
to filter df using multiple values df can use isin
, return boolean mask rows values exist in passed in list/series. in order filter out these values use negation operator ~
invert mask:
clean_df = df[~df['id'].isin(df_outlier['id'])]
Comments
Post a Comment