What is the difference between transform & transform_df in Palantir Foundry?

Viewed 495

Can someone explain why we need transform & transform_df methods separately?

1 Answers

There's a small difference between the @transform and @transform_df decorators in Code Repositories:

  • @transform_df operates exclusively on DataFrame objects.
  • @transform operates on transforms.api.TransformInput and transforms.api.TransformOutput objects rather than DataFrames.

If your data transformation depends exclusively on DataFrame objects, you can use the @transform_df() decorator. This decorator injects DataFrame objects and expects the compute function to return a DataFrame.

Alternatively, you can use the more general @transform() decorator and explicitly call the dataframe() method to access a DataFrame containing your input dataset.

Related