Using Prophet on Multiple Parts

Hello,

Does anyone know how to create forecasts using Prophet for multiple parts without creating individual workflows for each part?

Thank you!

One method is to create a pandas udf. So you would have all your data with the groups in a column, then you would define your function which applys your transformation to the grouped dataframe, along with the expected output schema. It can be a little tricky, but is one way to do it.

from pyspark.sql import types as T
def udf(df):
   df['value'] = 1
   return df[['name','value']]
schema =T.StructType([
    T.StructField('name', T.StringType()),
    T.StructField('value', T.StringType()),
])
df_out =df.groupby('group_column).applyInPandas(udf, schema)