lundi 18 avril 2022

how to randomize a matrix keeping the rows fixed in python

I'm trying to randomize all the rows of my DataFrame but with no success. What I want to do is from this matrix

A= [ 1 2 3
     4 5 6 
     7 8 9 ]

to this

A_random=[ 4 5 6 
           7 8 9 
           1 2 3 ]

I've tried with np. random.shuffle but it doesn't work.

I'm working in Google Colaboratory environment.




Aucun commentaire:

Enregistrer un commentaire