You have a pandas dataframe and you want to convert the index of the dataframe into a column.
Reading a dataset for illustration.
import pandas as pd url = 'https://raw.githubusercontent.com/bprasad26/lwd/master/data/ICICIBANK.NS.csv' df = pd.read_csv(url, index_col='Date') df.head()
As you can see that we have an index which contains the Date of the trading. Now suppose you want to convert this Date index to a Date column. To do that, you can use the reset_index method in pandas.
If you permanently change the dataframe then pass inplace=True in the reset_index.