My DataFrame contains two columns named 'a','b'. Now when I created a csv file of this DataFrame:
df.to_csv('myData.csv')
And when I opened this in an excel file, there is an extra column with indices that appears alongside the columns 'a' and 'b', but I don't want that. I only want columns 'a' and 'b' to appear in the excel sheet.
Is there any way to do this?
Try,
df.to_csv('myData.csv',index=False)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With