Reputation: 2273
I have this df:
A
migeludis 2
sandradsad 3
luislkdksd 4
juandsasdi 5
I would like to drop the rows in the df those index begin with luis
and sandra
to obtain this output:
A
migeludis 2
juandsasdi 5
Upvotes: 1
Views: 28
Reputation: 862801
Use boolean indexing
with str.startswith
and inverse condition by ~
:
df = df[~df.index.str.startswith(('luis','sandra'))]
print (df)
A
migeludis 2
juandsasdi 5
Upvotes: 1