# transforms.api.transform\_df ## transforms.api.transform\_df(output, \*\*inputs) {#transforms.api.transform\_df} Register the wrapped compute function as a DataFrame transform. The `transform_df` decorator is used to construct a [`Transform`](../api-transform/index.md#transforms.api.Transform) object from a compute function that accepts and returns [`pyspark.sql.DataFrame` ↗](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.html#pyspark.sql.DataFrame) objects. Similar to the [`transform()`](../api-transform/index.md#transforms.api.transform) decorator, the input names become the compute function’s parameter names. However, a `transform_df` accepts only a single [`Output`](../api-output/index.md#transforms.api.Output) spec as a positional argument. The return value of the compute function is also a [`DataFrame` ↗](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.html#pyspark.sql.DataFrame) that is automatically written out to the single output dataset. ```python >>> @transform_df( ... Output('/path/to/output/dataset'), # An unnamed Output spec ... first_input=Input('/path/to/first/input/dataset'), ... second_input=Input('/path/to/second/input/dataset'), ... ) ... def my_compute_function(first_input, second_input): ... # type: (pyspark.sql.DataFrame, pyspark.sql.DataFrame) -> pyspark.sql.DataFrame ... return first_input.union(second_input) ``` * **Parameters:** * **output** ([*Output*](../api-output/index.md#transforms.api.Output)) – The single [`Output`](../api-output/index.md#transforms.api.Output) spec for the transform. * **\*\*inputs** ([*Input*](../api-input/index.md#transforms.api.Input)) – `kwargs` comprised of named [`Input`](../api-input/index.md#transforms.api.Input) specs. :::callout{theme="success"} You can wrap a DataFrame transform with the [`incremental`](../api-incremental/index.md#transforms.api.incremental) decorator to run it incrementally. When `@incremental` wraps `transform_df`, inputs are read using the `added` mode and the write mode is determined by `@incremental`. If you need to read or write using non-default modes, use the [`transform()`](../api-transform/index.md#transforms.api.transform) decorator instead. ::: ```python >>> @incremental() ... @transform_df( ... Output('/path/to/output/dataset'), ... first_input=Input('/path/to/first/input/dataset'), ... ) ... def compute(first_input): ... # type: (pyspark.sql.DataFrame) -> pyspark.sql.DataFrame ... return first_input ```