how to drop last row in pandas code example
Example 1: drop last row pandas
df.drop(df.tail(n).index,inplace=True) # drop last n rows
Example 2: how to remove last 2 rows in a dataframe
df1 = df.iloc[:3]
df.drop(df.tail(n).index,inplace=True) # drop last n rows
df1 = df.iloc[:3]