Pandas 奇技淫巧
作者:互联网
1 随机采样 df.sample
df.sample(frac=0.06) # 随机取样(分数 四舍五入)
df.sample(frac=0.05) # 109*0.05=5.45 109*0.06=6.54
frac : float, optional
Fraction of axis items to return. Cannot be used withn
.
df.sample(n=5) # 5行
n : int, optional
Number of items from axis to return. Cannot be used withfrac
.
Default = 1 iffrac
= None.
标签:used,frac,df,sample,return,axis,Pandas,奇技淫巧 来源: https://blog.csdn.net/hezuijiudexiaobai/article/details/104783819