Community Halloween is live until October 31st! Complete any 2 quick activities to earn the 2025 Community Halloween badge. Feeling brave? Check out the activities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Python code to alteryx tools migration minute decimal value discrepancy

Akhilesh_30
5 - Atom

I've been working on optimizing an existing Alteryx workflow. Previously, this workflow utilized 6 separate Python tools for certain calculations. To improve performance and streamline the process, I've refactored the workflow, replacing the Python code with native Alteryx tools wherever possible.

The challenge I'm facing is that after this refactoring, I'm observing a consistent, albeit small, discrepancy in the "minute decimal" values between the original (Python-based) workflow and the new (Alteryx tool-based) workflow. This difference specifically appears in one particular calculated column.

Crucially, the formula used for this calculation is identical in both workflows. The only difference lies in how that formula is implemented:

  • Original Workflow: Python script performing the calculation.

  • New Workflow: A combination of Alteryx tools
    Any suggestions on how to further debug this or identify the exact point where the discrepancy is introduced within the Alteryx tool chain?

I am happy to provide:

  • A simplified version of the calculation formula.

  • Screenshots of the relevant Alteryx workflow sections.

  • Example input and output data (anonymized if necessary) showing the discrepancy.(I will be attaching this now)(One column is of python workflow and the other column data is of alteryx. They are dummy data resembling the issue)

Thank you in advance for your time and expertise!

Best regards,

Akhilesh

6 REPLIES 6
Gaurav_Dhama_
12 - Quasar

The major reason would be the way these two technologies use data type for calculations.

Alteryx uses Double type (this is irrespective of the type you have selected in select tool) and python uses float.

 

Even the rounding method can affect the values.

 

Check the level of precision you have in decimal places in values.

Can you confirm the libraries used in the python and if you rounded values anywhere in python and Alteryx?

OTrieger
14 - Magnetar

@Akhilesh_30 

Some how Alteryx is rounding the numbers a bit differently, we had the same issue comparing Alteryx to excel. It can be due to data type. Let say the original data type is Double and somewhere along the workflow you changed it to 2 decimals, from that point each new calculation will create a deviation from the original. Same thing can happen in Python, how it was coded, keeping 2 decimals or have a float number.

 

Review the 2 workflows to see if any of the data types is been change a long the automation. 

Akhilesh_30
5 - Atom

Hi thanks for the response!
Numpy,pandas and re libraries are used on python

var-x= round((var-a/ var-b) * 100, 1)
the same formula and rounding was used in alteryx workflow as well. With the same level of precision.
OTrieger
14 - Magnetar

It is not how the formula is set, but the data type. What is the data type in Alteryx for the fields var-a. var-b and var-x?

apathetichell
20 - Arcturus

If your issue is with precise data 10+ decimals --- I faced this issue ---> I ended up converting my python number to a string and sent it to Alteryx as a string ---> Once there I could convert to fixed decimal at whatever precision I needed. My memory -- and this was a few years and a few versions of python ago was that at it's core there was a limit to the precision that was passed between Python and Alteryx --- like 8 or 10 decimals.

 

 

Gaurav_Dhama_
12 - Quasar

Correct, and adding to that, if you need higher precision in python, you would need to use decimal module instead. That will give you higher decimal precision and you should get same results. Unless it’s manually rounded at some point.
Also, check for the rounding, in python, rounding is to even number. What that means is if you round 3.445 in python, it will round it to 3.44, but that will be converting to 3.45 in alteryx.

Labels
Top Solution Authors