pyflink.dataframe.dataframe.DataFrame.pipe#
- DataFrame.pipe(func: Callable[[...], T], *args: Any, **kwargs: Any) T[source]#
Apply a chainable function to the DataFrame.
Enables fluent method chaining with user-defined functions. The DataFrame is passed as the first argument to
func.- Parameters:
func – A function whose first argument is a DataFrame.
*args – Additional positional arguments passed to func.
**kwargs – Additional keyword arguments passed to func.
- Returns:
The return value of func.
- Example::
>>> import pyflink.dataframe as pf >>> def add_total(df): ... return df.with_column("total", pf.col("a") + pf.col("b")) ... >>> def filter_positive(df, col_name): ... return df.filter(pf.col(col_name) > 0) ... >>> result = ( ... df.pipe(add_total) ... .pipe(filter_positive, "total") ... )