Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to avoid Python/Pandas creating an index in a saved csv?

Asked by Christian Parsons Apr 17, 2021 1.2K views 1 answer
Share

About this question

I want to save a CSV to a folder after making some edits to the file.

Every time I use pd.to_csv('C:/Path of file.csv') the CSV file has a separate column of indexes. I want to avoid printing the index to CSV.

I tried:

pd.read_csv('C:/Path to file to edit.csv', index_col = False)

And to save the file...

pd.to_csv('C:/Path to save edited file.csv', index_col = False)

However, I still got the unwanted index column. How can I avoid this when I save my files?

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.