df_shuffled = dataset_n.sample(frac = 1) code example Example: pandas shuffle rows df = df.sample(frac=1).reset_index(drop=True)