To shuffle pandas DataFrame df
df = df.sample(frac=1, random_state=123).reset_index(drop=True)
Alternatively, you can use sklearn.utils.shuffle().
#pandas
@Python_Codes
(
in a reproducible way):df = df.sample(frac=1, random_state=123).reset_index(drop=True)
Alternatively, you can use sklearn.utils.shuffle().
#pandas
@Python_Codes