python dataframe打乱行

import pandas as pd
data1 = {
    "a":[1,2,3,12,13,14],
    "b":[4,5,6,15,16,17],
    "c":[7,8,9,18,19,20]
}
df=pd.DataFrame(data1)

from sklearn.utils import shuffle
df = shuffle(df)

效果:

python dataframe打乱行_第1张图片

(打乱前)

python dataframe打乱行_第2张图片

(打乱后)

你可能感兴趣的:(pandas,python,数据分析)