I want to exclude some rows in my pandas' dataframe if they have certain values.
excluded_url_subpath = ['/editer', '/administration', '/voir-les-transactions', '/modifier', '/diffuser', '/creation-paiement']
So I have the, working, solution to do it one by one like :
df = df[df['pagepath'].map(lambda x: False if '/editer' in x else True)]
df = df[df['pagepath'].map(lambda x: False if '/administration' in x else True)]
...
Or I can use the list I wrote. But I tried some stuff and the IDE told me that I cannot access the variable x
.
df = df[df['pagepath'].map(lambda x: False for i in excluded_url_subpath if x in i)]
Where is the error here ?