edf.select(\"x\").distinct.show() shows the distinct values that are present in x column of edf DataFrame.
edf.select(\"x\").distinct.show()
x
edf
Is there an efficient
Another option without resorting to sql functions
df.groupBy('your_column_name').count().show()
show will print the different values and their occurrences. The result without show will be a dataframe.