You want to drop a list of rows from a dataframe in pandas.
Read a dataset to work with.
import pandas as pd url = 'https://raw.githubusercontent.com/bprasad26/lwd/master/data/LargeCorp.csv' df = pd.read_csv(url) df.head()
Let’s say you want to drop the rows with index 2 and 3. To do that you have to use the drop method and pass the index of the rows that you want to drop.