reaching last rowof dataframe code example
Example 1: location of last row dataframe
rows = df.iloc[-2:]
Example 2: pandas change last row
a.iloc[-1, a.columns.get_loc('a')] = 77
>>> a
a b c
0 1 2 3
1 4 5 6
2 77 8 9
rows = df.iloc[-2:]
a.iloc[-1, a.columns.get_loc('a')] = 77
>>> a
a b c
0 1 2 3
1 4 5 6
2 77 8 9