Answers for "randomize dataframe row order"

2

shuffle rows dataframe

df = df.sample(frac=1).reset_index(drop=True) #Use if you want to reset index order

df.sample(frac=1) # Use for no reset in index order
Posted by: Guest on July-17-2021

Code answers related to "randomize dataframe row order"

Python Answers by Framework

Browse Popular Code Answers by Language