Using iloc to get the last row of a Pandas DataFrameMohamad Mahmood·Feb 9, 2024·1 min readimport 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: Pythonpandas Share this