How do I remove the first column in the table below, in Python, which is created when I generate a csv from a data frame in Python? Or is there a way to prevent this first column from being created in the first place.
CodePudding user response:
When you use pandas.to_csv(), there is the index
param setted True by default. This means that it will write a column for the index.
If you want to prevent index writing, you have to set it to false:
df.to_csv(your_path, index=False)