show distinct column values in pyspark dataframe: python

后端 未结 9 854
忘了有多久
忘了有多久 2020-12-23 10:55

Please suggest pyspark dataframe alternative for Pandas df[\'col\'].unique().

I want to list out all the unique values in a pyspark dataframe column.

9条回答
  •  無奈伤痛
    2020-12-23 11:31

    If you want to select ALL(columns) data as distinct frrom a DataFrame (df), then

    df.select('*').distinct().show(10,truncate=False)

提交回复
热议问题