pandas how to set dataframe where last row is first code example Example: location of last row dataframe rows = df.iloc[-2:]