The .distinct(...) transformation

The .distinct(...) transformation returns a list of distinct values from a column. An equivalent in SQL would be DISTINCT.

Look at the following code:

# select the distinct values from the RAM column

sample_data_schema.select('RAM').distinct().show()

It produces the following result:

In SQL syntax, this would be:

SELECT DISTINCT RAM
FROM sample_data_schema
..................Content has been hidden....................

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