Reputation: 9538
I have searched a lot about this topic of how to remove the index column of the datframe when exporting the dataframe to csv file. I found many solutions and tricks but none of them worked with me. In the csv output I got 0 (the column index) at the first row of the CSV output. Can you guide me of fixing such a problem?!!
Upvotes: 0
Views: 1771
Reputation: 1351
Are you using pandas? If so, you can use the .to_csv method with the argument index=False to remove index:
df.to_csv('output.csv', index=False)
or header=False to remove column names:
df.to_csv('output.csv', header=False)
Upvotes: 1