Reputation: 79
I want to delete duplicates from the below df, preserving the case sensitivity.
Input df
df = pd.DataFrame({
'company_name': ['Apple', 'apple','apple', 'BlackBerry',
'blackberry','Blackberry']
})
Expected df
company_name
0 Apple
1 apple
2 BlackBerry
3 blackberry
4 Blackberry
Upvotes: 1
Views: 108
Reputation: 19252
You can use drop_duplicates
with ignore_index=True
:
df.drop_duplicates(ignore_index=True)
This outputs:
company_name
0 Apple
1 apple
2 BlackBerry
3 blackberry
4 Blackberry
Upvotes: 1