Spark2 Dataset統計指標:mean均值,variance方差,stddev標準差,corr(Pearson相關係數),skewness偏度,kurtosis峰度

智慧先行者發表於2016-11-25
val df4=spark.sql("SELECT mean(age),variance(age),stddev(age),corr(age,yearsmarried),skewness(age),kurtosis(age) FROM Affairs")

df4.show
+--------+------------------+------------------+-----------------------+-----------------+--------------------+
|avg(age)|     var_samp(age)|  stddev_samp(age)|corr(age, yearsmarried)|    skewness(age)|       kurtosis(age)|
+--------+------------------+------------------+-----------------------+-----------------+--------------------+
|    34.0|173.33333333333334|13.165611772087667|     0.7456766124552038|0.965388004190285|-0.43417159763313595|
+--------+------------------+------------------+-----------------------+-----------------+--------------------+

 

相關文章