import pandas as pd df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9]}) # Swap the first and second rows df.iloc[0], df.iloc[1] = df.iloc[1], df.iloc[0].copy() print(df)