1

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
BrokenBenchmark
  • 18,126
  • 7
  • 21
  • 33

1 Answers1

1

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
BrokenBenchmark
  • 18,126
  • 7
  • 21
  • 33