get the last row of pandas dataframe code example
Example 1: drop the last row of a dataframe
df.drop(df.tail(n).index,inplace=True) # drop last n rows
Example 2: location of last row dataframe
rows = df.iloc[-2:]
df.drop(df.tail(n).index,inplace=True) # drop last n rows
rows = df.iloc[-2:]