pandas dataframe remove last row 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]
Example 3: get duplicate and remove but keep last in python df
drop_duplicates(self, subset=None, keep="last", inplace=False)