Quantcast
Viewing all articles
Browse latest Browse all 14011

How to change an Index of DataFrame?

I have a DataFrame with an index column as [0, 1,2,3]. I would like to change it to ['Q1','Q2','Q3','Q4']. How do I do this? I do not want to introduce a new column but change index only.

I triedqtrs = ['Q1', 'Q2', 'Q3', 'Q4']anddf.reindex(qtrs)where df is the DataFrame.

It does not work!


Viewing all articles
Browse latest Browse all 14011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>