SyntaxFix
Write A Post
Hire A Developer
Questions
To drop rows with indices 1, 2, 4 you can use:
df[~df.index.isin([1, 2, 4])]
The tilde operator ~ negates the result of the method isin. Another option is to drop indices:
~
isin
df.loc[df.index.drop([1, 2, 4])]