How to Drop a List of Rows from a Pandas Dataframe?

Spread the love

Problem –

You want to drop a list of rows from a dataframe in pandas.

Solution –

Read a dataset to work with.

import pandas as pd

url = ''
df = pd.read_csv(url)

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.


Rating: 1 out of 5.

Leave a Reply