Closed
Description
In the following snippet the two to_csv calls differs only in the index argument. Although the output header in the first case is (index), 'X', 'Y' but in the second case is 'A', 'B'. The documentation didn't suggest that sort of difference.
import pandas as pd
df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
df.to_csv('testtocsv1.csv', header=['X', 'Y'])
df.to_csv('testtocsv2.csv', index=False, header=['X', 'Y'])