-
1.删除重复行:
-
In the output, we can see that it removes duplicated rows. It is the default behavior of the drop_duplicate() function.
-
It retains the first value and removes further duplicates.
import pandas as pd
data = pd.read_excel('C:\Temp\data.xlsx')# file destination
#print(data)
data.drop_duplicates()
-
2.删除重复列:
-
Reference:
https://www.sqlshack.com/removing-duplicates-in-an-excel-sheet-using-python-scripts/
https://www.sqlshack.com/python-scripts-to-format-data-in-microsoft-excel/
网友评论