python - Shuffle DataFrame rows - Stack Overflow
https://stackoverflow.com/questions/2957643010.04.2015 · Note: If you wish to shuffle your dataframe in-place and reset the index, you could do e.g. df = df.sample(frac=1).reset_index(drop=True) Here, specifying drop=True prevents .reset_index from creating a column containing the old index entries.. Follow-up note: Although it may not look like the above operation is in-place, python/pandas is smart enough not to do …