I looked at the unique values in a column of a dataframe - pandas that I have. And there are some names in one of the columns that I do not want to include, how do I remove those rows from the dataframe, without using index value notation, but by saying if row value = "this" then remove
like...
new = df.copy
df['some column'].drop_values('this','that','other')
See indexing with isin
(also, boolean indexing ):
mask = df['some column'].isin(['this', 'that', 'other'])
df[~mask]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.