You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: df = pd.DataFrame([[1,2,3,4],[5,6,7,8]], columns=['A','B','A','B'])
In [2]: df
Out[2]:
A B A B
0 1 2 3 4
1 5 6 7 8
In [4]: df.to_excel('test_excel_duplicate_columns.xlsx')
gives:
So the values of columns 2 and 3 are swapped (not the column names)
BTW, this happens both with .xlsx as .xls (openpyxl / xlsxwriter / xlwt)