The .groupBy(...) transformation

The .groupBy(...) transformation performs data aggregation based on the value (or values) from a column (or multiple columns). In SQL syntax, this equates to GROUP BY.

Look at the following code:

(
sample_data_schema
.groupBy('RAM')
.count()
.show()
)

It produces this result:

In SQL syntax, this would be:

SELECT RAM
, COUNT(*) AS count
FROM sample_data_schema
GROUP BY RAM
..................Content has been hidden....................

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