shuffle a pandas dataframe scratch code example Example: shuffle dataframe python df = df.sample(frac=1).reset_index(drop=True)