snowflake.snowpark.RelationalGroupedDataFrame.applyInPandas¶
- RelationalGroupedDataFrame.applyInPandas(func: Callable, output_schema: StructType, **kwargs) DataFrame[source]¶
Maps each grouped dataframe in to a pandas.DataFrame, applies the given function on data of each grouped dataframe, and returns a pandas.DataFrame. Internally, a vectorized UDTF with input
funcargument as theend_partitionis registered and called. Additionalkwargsare accepted to specify arguments to register the UDTF. Group by clause used must be column reference, not a general expression.Depends on
pandasbeing installed in the environment and declared as a dependency usingadd_packages()or viakwargs["packages"].- Parameters:
func – A Python native function that accepts a single input argument - a
pandas.DataFrameobject and returns apandas.Dataframe. It is used as input toend_partitionin a vectorized UDTF.output_schema – A
StructTypeinstance that represents the table function’s output columns.kwargs – Additional arguments to register the vectorized UDTF. See
register()for all options.
- Examples::
Call
apply_in_pandasusing temporary UDTF:Call
apply_in_pandasusing permanent UDTF with replacing original UDTF:
See also