GitHub user Shanshan-IC opened a pull request: https://github.com/apache/spark/pull/18585
SPARK-21359 ## What changes were proposed in this pull request? As described in https://issues.apache.org/jira/browse/SPARK-21359 add new functions for frequency discretizer transformation ## How was this patch tested? test example: val data = Array((0, 18.0), (1, 19.0), (2, 8.0), (3, 5.0), (4, 2.2), (5, 1.0), (6, 9.1), (7, 10.1), (8, 1.1), (9, 16.0), (10, 20.0), (11, 20.0)) val df = spark.createDataFrame(data).toDF("id", "hour") val frequency = new FrequencyDiscretizer() .setInputCol("hour") .setOutputCol("result") .setNumBuckets(4) val result = frequency.fit(df).transform(df) result.show() You will get: +---+----+------+ | id|hour|result| +---+----+------+ | 0|18.0| 2.0| | 1|19.0| 3.0| | 2| 8.0| 1.0| | 3| 5.0| 1.0| | 4| 2.2| 0.0| | 5| 1.0| 0.0| | 6| 9.1| 1.0| | 7|10.1| 2.0| | 8| 1.1| 0.0| | 9|16.0| 2.0| | 10|20.0| 3.0| | 11|20.0| 3.0| +---+----+------+ Please review http://spark.apache.org/contributing.html before opening a pull request. You can merge this pull request into a Git repository by running: $ git pull https://github.com/Shanshan-IC/spark mybranch Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/18585.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #18585 ---- commit ba99deab14189aab69f38a8ebc5e5d3939dec1eb Author: fushanshan <fushans...@qiyi.com> Date: 2017-07-10T09:14:05Z frequencydiscretizer ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org