Skewness

Skewness measures the asymmetry of the values in your data around the average or mean.

The skewness API has several implementations, as follows. The exact API used depends on the specific use case.

def skewness(columnName: String): Column
Aggregate function: returns the skewness of the values in a group.

def skewness(e: Column): Column
Aggregate function: returns the skewness of the values in a group.

Let's look at an example of invoking skewness on the DataFrame on the Population column:

import org.apache.spark.sql.functions._
scala> statesPopulationDF.select(skewness("Population")).show

+--------------------+
|skewness(Population)|
+--------------------+
| 2.5675329049100024|
+--------------------+
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.107.64