Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Metadata is missing column contained in Dataframe error from Python code in Alteryx

aggressivedonut
5 - Atom

I have a multi index dataframe from Python code (Pandas) and I am trying to output this dataframe to Alteryx. However I am getting an error message when I use the Alteryx.write(df,1) function.

 

Dataframe output looks something like this:

Capture.PNG

Where there are columns with two sub-headers each.

 

 

The error says: 

 

ReferenceError: [Datafile.writeData]: metadata is missing column contained in pandas_df: ('Column A', 'Return')

 

I understand Alteryx may not know how to handle dataframe with multiple column headers/multi index. Is there a workaround for this? Can I directly write to Excel with my Python code in the workflow and add that excel file back to the workflow to make changes to the dataframe?

 

 

1 REPLY 1
Felipe_Ribeir0
16 - Nebula

Hi @aggressivedonut 

 

Could you reshape your dataframe to look like this, and export it to alteryx after that? You would have the same information that you have now, but with a format that wouldnt cause this issue. Even if you write to excel and take the data back to the workflow, you would still have problems with this "2 headers multi index". 

 

Felipe_Ribeir0_0-1672942287775.png

 

Labels