目录

  • ​​随机抽样​​

随机抽样

import pandas as pd
import numpy as np

# 随机生成100000行3列的数据
df = pd.DataFrame(np.random.randn(100000,3),columns = ['red','green','blue'])
# 生成1000条随机索引值
index = np.random.randint(0,100000,size = 1000)
# take 取拿
df.take(index)