1
Given the df as indicated below (could be a greater good), I would like to delete in df the data of the lines according to the list 'listFilter'.
nome = ['foo','bar','fiz','zaz','foo','far','bar','fiz','cdd','boo','zuz','zuz']
valor = [2,3,2,5,6,7,2,9,6,3,8,10]
listaFiltro = ['zuz', 'boo']
df = pd.DataFrame({'nome': nome, 'valor': valor})
nome valor
0 foo 2
1 bar 3
2 fiz 2
3 zaz 5
4 foo 6
5 far 7
6 bar 2
7 fiz 9
8 cdd 6
9 boo 3
10 zuz 8
11 zuz 10
I’ve tried to use it that way here but unsuccessfully:
df = df.drop(df[df.nome] != listaFiltro.index)