drop duplicates pandas python code example
Example 1: df remove duplicate rows
df = df.drop_duplicates()
p
Example 2: drop duplicates pandas considering lowercase
result_df = df.apply(lambda x: x.astype(str).str.lower()).drop_duplicates(subset=['Column1', 'Column2'], keep='first')
print(result_df)
Column1 Column2 Column3
0 'cat' 'bat' 'xyz'
1 'toy' 'flower' 'abc'