I have a dataset which is similar to the sample dataset attached.
My original dataset is such that I have used Python tool to manipulate it. One of the final steps in it is to convert multiple long format columns into wide format. After this I need to extract this output in an excel file. In order to achieve this, I have written "Alteryx.write(df,1)" but it gives me the error as mentioned below:
Error: Python (2): ---------------------------------------------------------------------------
ReferenceError Traceback (most recent call last)
<ipython-input-7-1fa927026b68> in <module>
----> 1 Alteryx.write(df1,1)
c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\ayx\export.py in write(pandas_df, outgoing_connection_number, columns, debug, **kwargs)
85 When running the workflow in Alteryx, this function will convert a pandas data frame to an Alteryx data stream and pass it out through one of the tool's five output anchors. When called from the Jupyter notebook interactively, it will display a preview of the pandas dataframe. An optional 'columns' argument allows column metadata to specify the field type, length, and name of columns in the output data stream.
86 """
---> 87 return __CachedData__(debug=debug).write(
88 pandas_df, outgoing_connection_number, columns=columns, **kwargs
89 )
c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\ayx\CachedData.py in write(self, pandas_df, outgoing_connection_number, columns, output_filepath)
639 try:
640 # get the data from the sql db (if only one table exists, no need to specify the table name)
--> 641 data = db.writeData(pandas_df_out, metadata=write_metadata)
642 # print success message
643 if outgoing_connection_number is not None:
c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\ayx\Datafiles.py in writeData(self, pandas_df, metadata)
750 )
751 print(error_msg)
--> 752 raise ReferenceError(error_msg)
753
754 metadata_col = metadata[colname]
ReferenceError: [Datafile.writeData]: metadata is missing column contained in pandas_df: ('Hourly', 'IT', '2018')
I'm unable to rectify this error. Could someone please help me solve this error so that I can extract the output in an excel file? I have attached the sample input and workflow for reference. Thank you!