pandas randomize order of dataframe rows code example Example: python randomize a dataframe pandas df = df.sample(frac=1).reset_index(drop=True)