mercredi 25 juillet 2018

I need to random shuffle rows of two pandas DataFrames in the same random way

I have two dataframes, A and B , with dimension MxN which rows I want to random shuffle. A and B have the same column names and indexes. I know how to shuffle data inside each column with df.apply(np.random.shuffle) method, but it permutate differently each column. I want that if the first row of A becames the second row after shuffle, the first row of B becames the second row too, etc. How can I do what I want?




Aucun commentaire:

Enregistrer un commentaire