how to remove last n rows of a dataset in python code example Example: drop the last row of a dataframe df.drop(df.tail(n).index,inplace=True) # drop last n rows