I'm trying to export the following dataframe to a csv file
with the following line of code:
df.to_csv("Result.csv", encoding = "utf-8-sig")
but the output looks really weird:
I would like it to use the different columns of the csv to input the data, but what it's doing is putting everything in the same column of cells.
Any idea what I'm doing wrong? Thanks in advance.
CodePudding user response:
The CSV looks good to me. Excel uses e.g. semicolon in some locales so it doesn't import CSV files in that locale. You could use to_csv(..., sep=';')
and see if it helps. In the end, it will depend on the locale settings on the computer in which the CSV is opened, so you can never be sure that your code will work "correctly" with Excel.