write_with_schema including Index to output

dataiku_user
Level 2
write_with_schema including Index to output
I need to write a pandas dataframe to dataiku output, with the index values. However the write_with_schema doesn't write out the index values
0 Kudos
2 Replies
Alex_Combessie
Dataiker Alumni
Hi,

Before using the `write_with_schema` method, you can put
df["index_col"] = df.index

Then your pandas data frame will have an actual "index_col" column written.

Cheers,

Alex
0 Kudos
AlexM
Level 1

I had the same issue. 

Just add .reset_index() at the end of your dataframe or add df = df.reset_index() before you write your dataset.

0 Kudos