I am trying to shuffle a pandas dataframe by row instead of column.
I have the following dataframe:
row1 row2 row3
1 3 1 6
2 5 2 7
3 7 3 8
4 9 4 9
And would like to shuffle the df to achieve a random permutation such as:
row1 row2 row3
1 6 3 1
2 3 9 2
3 7 5 8
4 4 9 7
I tried:
df1 = df.reindex(np.random.permutation(df.index))
however, this permutes only by column and not row.