July 2017
Intermediate to advanced
796 pages
18h 55m
English
A common task seen in data analysis is to group the data into grouped categories and then perform calculations on the resultant groups of data.
Let's run groupBy function on the DataFrame to print aggregate counts of each State:
scala> statesPopulationDF.groupBy("State").count.show(5)+---------+-----+| State|count|+---------+-----+| Utah| 7|| Hawaii| 7||Minnesota| 7|| Ohio| 7|| Arkansas| 7|+---------+-----+
You can also groupBy and then apply any of the aggregate ...
Read now
Unlock full access