Show distinct column values in pyspark dataframe

This should help to get distinct values of a column:

df.select('column1').distinct().collect()

Note that .collect() doesn’t have any built-in limit on how many values can return so this might be slow — use .show() instead or add .limit(20) before .collect() to manage this.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)