Using iloc to get the last row of a Pandas DataFrame

import pandas as pd

# Example DataFrame
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})

# Get the last row using iloc
last_row = df.iloc[-1]

print("Last row:")
print(last_row)

output: