How to Remove the First n Rows of a Pandas DataFrame

Published Nov 30, 2021  ∙  Updated May 2, 2022

How can we remove the first n rows of a Pandas DataFrame?

Remove rows with iloc

We can use iloc to remove the first n rows.

df = df.iloc[n:]

Remove rows with tail

We can also use tail to do the same.

df = df.tail(-n)

Remove rows with drop

Lastly, we can use drop as well.

df.drop(df.index[:n], inplace=True)
# OR
df.drop(df.head(n).index, inplace=True)