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

Alteryx Designer Desktop Discussions

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

Python Tool Output is different to print statement

DemetrisH
6 - Meteoroid

I am having an issue with the python tool. I create a dataframe (called df_LS in the picture below), which I print to screen. As you can see from the message  in the python tool, it prints the following:

     Score     Variables
0  0.078739  Sepal_length
1  0.182821   Sepal_width
2  0.020822  Petal_length
3  0.025965   Petal_width

 However the output from the connection data 1, shows up as follows:

Score Variables
0.078739 Sepal_length
-0.589666 Sepal_width
0.033873 Petal_length
0.001242 Petal_width

 

Any ideas as to what is happening between the "print(df_LS)" statement and the "Alteryx.write(df_LS,1)" statement?

 

Thanks!

 

Demetris_0-1580476108842.png

3 REPLIES 3
CharlieS
17 - Castor
17 - Castor

Edit: I see now that you're referring to the value differences. 

 

Is there any chance the calculations are being performed on difference data? It looks like this is a part of a macro, when you run the code in the Python tool and run the workflow, the workflow could be inputting and executing on different observations. Are you running this macro on its own, or as a part of a larger workflow when you notice this discrepancy? 

DemetrisH
6 - Meteoroid

As this is still in testing mode, I'm running this macro on its own and not as part of a larger workflow.

DemetrisH
6 - Meteoroid

As a temporary solution to this, i limit all the floating number columns in the dataframe to 10 decimal places. So for a dataframe called df with one floating number column called "num_col", i perform the following operation in python before writing output to Alteryx:

 

df["num_col"] = df["num_col"].round(10)

 

This appears to work, but I'm not yet sure what the underlying issue is.

Labels
Top Solution Authors