import numpy as np import pandas as pd df=pd.DataFrame(np.arange(25).reshape(5,5)) new_order=np.random.permutation(5)#不暗中哦顺序排列 print(df.take(new_order))#take改变索引 sample=np.random.randint(0,len(df),size=2) print(df.take(sample))#随机抽样
import numpy as np import pandas as pd df=pd.DataFrame(np.arange(25).reshape(5,5)) new_order=np.random.permutation(5)#不暗中哦顺序排列 print(df.take(new_order))#take改变索引 sample=np.random.randint(0,len(df),size=2) print(df.take(sample))#随机抽样