Reputation: 426
I have a excel file with this data
Python
C++
Pandas
python
PHP
and I want to remove duplicated with ignoring case, my code :
import pandas as pd
data = pd.read_excel('data.xlsx', header=None)
data = data.drop_duplicates()
data.to_excel('sts.xlsx', index=False, header=False)
Upvotes: 1
Views: 65
Reputation: 71600
Try this instead:
import pandas as pd
data = pd.read_excel('data.xlsx', header=None)
data = data.iloc[data.iloc[:, 0].str.lower().drop_duplicates().index]
data.to_excel('sts.xlsx', index=False, header=False)
Upvotes: 2