可自定义函数实现,代码如下:
def winsorize(x, downPercentile, upPercentile){ uplimit = percentile(x, upPercentile) downlimit = percentile(x, downPercentile) return iif(x > uplimit, uplimit, iif(x < downlimit, downlimit, x)) } x= rand(1.0, 1000000) y = winsorize(x, 5, 95)