python - Pandas: check if column value is unique - Stack Overflow

PHOTO EMBED

Sun Aug 27 2023 23:02:43 GMT+0000 (Coordinated Universal Time)

Saved by @yfontes #python

df['unique'] = ~df['value'].duplicated(keep=False)
print (df)
   value  unique
0      1    True
1      2   False
2      2   False
3      3    True
4      4   False
5      4   False
content_copyCOPY

https://stackoverflow.com/questions/66869710/pandas-check-if-column-value-is-unique