0

I want to get back my current index variable as a column variable. Is it possible?I tried using df.reset_index() but it did not work.Please click the link to view current version of fataframe

Ex:Please Click here to view the current data frame. I want back "Date" as column variable

1
  • 3
    df = df.reset_index() Commented Apr 22, 2020 at 16:59

1 Answer 1

1

you could use

df['new_column'] = df.index

It will copy the index as is, so if it's a datetime index then the new column will be a datetime column as well.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.