Example: Grouping data in a simple way![Scala logo](data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20143%2061%22%3E%3C/svg%3E)
Example where people table is grouped by last name.
df.groupBy("surname").count().show()
+-------+-----+ |surname|count| +-------+-----+ | Martin| 1| | Garcia| 3| +-------+-----+
Example: pooling data combined with filter
Example where the people table is grouped by surname and the ones with more than 2 appearances are Selected.
df.groupBy("surname").count().filter("count > 2").show()
+-------+-----+ |surname|count| +-------+-----+ | Garcia| 3 | +-------+-----+
0 Comments