python spark 求解最大 最小 平均
2017-07-12 10:15
351 查看
rdd = sc.parallelizeDoubles(testData); |
1 | LOGGER.info("Mean: " + rdd.mean()); |
Every time one of this method is invoked , Spark performs the operation on the entire RDD data. If more than one operations performed, it will repeat again and again which is very inefficient. To solve this, Spark provides “StatCounter” class which executes once and provides results of all basic statistics operations in the same time.
1 | StatCounter statCounter = rdd.stats(); |
1 2 3 4 5 6 7 | LOGGER.info("Count: " + statCounter.count()); LOGGER.info("Min: " + statCounter.min()); LOGGER.info("Max: " + statCounter.max()); LOGGER.info("Sum: " + statCounter.sum()); LOGGER.info("Mean: " + statCounter.mean()); LOGGER.info("Variance: " + statCounter.variance()); LOGGER.info("Stdev: " + statCounter.stdev()); |
相关文章推荐
- python spark 求解最大 最小 平均 中位数
- matlab练习程序(求灰度图像最大灰度,最小灰度,平均灰度)
- awk实现求和、平均、最大值和最小值的计算操作
- python 实现求和、计数、最大最小值、平均值、中位数、标准偏差、百分比。
- 求解三个数的最大的数,求最小的同…
- 2014多校1009--hdu4968--Improving the GPA(平均成绩的最大最小平均学分)
- RMQ 问题 POJ 3264 求解任意指定区间内的最小值和最大值
- 求灰度图像最大灰度,最小灰度,平均灰度
- 算法 图中求最小环路径 最小环个数 最大平均环 求简单无向图中环的个数
- Python: tkinter窗口屏幕居中,设置窗口最大,最小尺寸
- awk实现求和、平均、最大值和最小值的计算操作
- poj 2987(最大权闭合图)最小割求解:关键是思路
- awk实现求和、平均、最大值和最小值的计算操作
- 用递归法求解一个数组中的最大值和最小值的问题
- 求解二维数组的最大/最小元素
- 扫描算法求解连续子向量的最大和问题(Python)
- C#关于平均值,最大值,最小值的求解
- 达内实训—第二天小练习(输入班级成绩 求平均分数 最大分数 最小分数)
- 网络流-最大权闭合图(最小割求解)
- poj3041 最小点覆盖==二分图最大匹配 匈牙利算法求解最大匹配问题(运用DFS)