【发布时间】:2021-02-02 17:09:09
【问题描述】:
我在 pyspark 数据框中有三列(示例数据如下)
| orderType | customerId | amount |
|---|---|---|
| A | c1 | 100.2 |
| A | c2 | 1003.32 |
| B | c1 | 222 |
| C | c3 | 21.3 |
| A | c4 | 1.2 |
我想从每个 orderType 中删除异常值。为了做到这一点,我从每个 orderType 的数据中删除了前 Nth Percentile。
例如对于 N = 10,对于每个组,我将根据数量和 partitionBy orderType 获取第 10 到第 90 个百分位数的数据。
需要帮助来为大型数据集(大约 6700 万行计数)实现该功能。
如果在这种情况下适用,也有人可以帮助可能在分区上使用分位数。
【问题讨论】:
标签: python apache-spark pyspark apache-spark-sql percentile