0

I have this dataframe df:

col1  col2  col3
673   89279 902
893   894   897
083   37    23
94    382   342

And I need to randomaly shuffle the rows except the first one, any help with that please?

LamaMo
  • 576
  • 2
  • 8
  • 19
  • No, in that post is how to shuffle the all dataframe rows, here I want to specify range of rows (from 2nd to the end, i.e all except the first row) @ChristianSloper – LamaMo Dec 07 '20 at 19:08

1 Answers1

2

Try this

df = pd.concat([df[:1], df[1:].sample(frac=1)]).reset_index(drop=True)