Answers for "how to get unique rows in pandas"

1

get list of unique values in pandas column

a = df['column name'].unique() #returns a list of unique values
Posted by: Guest on March-29-2021
0

distinct rows in this DataFrame

# distinct rows in this DataFrame

df.distinct().count()
# 2
Posted by: Guest on April-20-2020
0

how to get unique value of all columns in pandas

print(df.apply(lambda col: col.unique()))
Posted by: Guest on August-05-2021
0

dataframe number of unique rows

1
# get the unique values (rows) by retaining last row
2
df.drop_duplicates(keep='last')
Posted by: Guest on September-28-2020
-1

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
Posted by: Guest on April-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language