write_with_schema including Index to output

dataiku_user
dataiku_user Registered Posts: 7 ✭✭✭✭
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
Tagged:

Answers

  • Alex_Combessie
    Alex_Combessie Alpha Tester, Dataiker Alumni Posts: 539 ✭✭✭✭✭✭✭✭✭
    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
  • AlexM
    AlexM Registered Posts: 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.

Setup Info
    Tags
      Help me…