Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check every pandas series value is unique

Tags:

I know how to count the number of unique values in pandas series (one column in pandas dataframe).

pandas.Series.value_counts 

But how do I check if they are all unique? Should I just compare value_counts with its length?

like image 794
aerin Avatar asked Feb 17 '18 05:02

aerin


1 Answers

IIUC, pd.Series.is_unique

pd.Series([1, 2, 3]).is_unique True 

And

pd.Series([1, 2, 2]).is_unique False 
like image 174
piRSquared Avatar answered Oct 17 '22 06:10

piRSquared