dataframe unique rows code example
Example 1: distinct rows in this DataFrame
# distinct rows in this DataFrame
df.distinct().count()
# 2
Example 2: dataframe unique values in each column
for col in df:
print(df[col].unique())
Example 3: df remove duplicate rows
df = df.drop_duplicates()
p
Example 4: unique values in dataframe column
#List unique values in the df['name'] column
df.name.unique()
Example 5: Returns a new DataFrame containing the distinct rows in this DataFrame
# Returns a new DataFrame containing the distinct rows in this DataFrame
df.ditinct().count()
# 2