I have a pandas
dataframe, df
.
I want to select all indices in df
that are not in a list, blacklist.
Now, I use list comprehension to create the desired labels to slice.
ix=[i for i in df.index if i not in blacklist]
df_select=df.loc[ix]
Works fine, but may be clumsy if I need to do this often.
Is there a better way to do this?