Loading

TabPy Scripts Return Incorrect Results Due to Unsorted Rows in Tableau Prep Builder

Publish Date: May 15, 2026
Description

When running a flow in Tableau Prep Builder that utilizes a Python script via TabPy, the script processing results may be incorrect.

This issue typically occurs under the following conditions:

  • The flow involves a Union of multiple files or a large dataset (e.g., exceeding a certain file count or size).
  • The Python script performs calculations that depend on the specific order of rows, such as time-series analysis, smoothing, or moving averages.
  • No error messages appear in Tableau Prep or TabPy logs; the flow completes successfully, but the data values are not calculated as expected.
  • Changing the TABPY_MAX_REQUEST_SIZE_MB configuration does not resolve the issue.

Cause:

Tableau Prep does not guarantee the order of rows sent to TabPy. Particularly with large datasets, parallel processing may occur, causing data to be processed in a non-sequential order.

Resolution

Modify the Python script to explicitly sort the data before performing order-dependent calculations. For example, sort by a unique identifier or timestamp column using df.sort_values() to ensure row order is preserved.

Note: The implementation and maintenance of custom Python scripts, including adding sorting logic, is outside the scope of Tableau Technical Support. Support is available for potential product defects and unmodified sample code only. If you require assistance with creating or maintaining custom scripts, please consider contacting your Account Executive regarding Tableau Professional Services.

Knowledge Article Number

005237277

 
Loading
Salesforce Help | Article