![]() |
How to define index column name using df.to_csv - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to define index column name using df.to_csv (/thread-24430.html) |
How to define index column name using df.to_csv - SriRajesh - Feb-13-2020 Hi, I have dataframe, and I want to write to csv. But when write to csv, the first column name disaaper (which is Index) Before write, Index c1 c2 A 2 5 B 5 9 I use below command, summary_table.to_csv('outsummary2.csv',index=True,header=True)when I open csv file, data look like: c1 c2 A 2 5 B 5 9how can rename the index column name? to look like my data: Names c1 c2 A 2 5 B 5 9 |