Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure @pandas_udf给了我语法错误_Azure_Pyspark_Databricks_Azure Databricks - Fatal编程技术网

Azure @pandas_udf给了我语法错误

Azure @pandas_udf给了我语法错误,azure,pyspark,databricks,azure-databricks,Azure,Pyspark,Databricks,Azure Databricks,@pandas_udf(schema,functionType=PandasUDFType.GROUPED_MAP)为我提供了语法错误:由于@sign,在Azure Datatricks中解析时出现意外的EOF。 是否有任何pyspark udf可替代pandas_udf? “应该用其他东西来代替吗?” 我正在尝试运行以下代码: @pandas_udf(result_schema, PandasUDFType.GROUPED_MAP) ####ERROR def forecast_store_i

@pandas_udf(schema,functionType=PandasUDFType.GROUPED_MAP)为我提供了语法错误:由于@sign,在Azure Datatricks中解析时出现意外的EOF。 是否有任何pyspark udf可替代pandas_udf? “应该用其他东西来代替吗?”

我正在尝试运行以下代码:

@pandas_udf(result_schema, PandasUDFType.GROUPED_MAP) ####ERROR
def forecast_store_item(history_pd):
    # instantiate the model, configure the parameters
    model = Prophet(
        interval_width=0.95,
        growth='linear',
        daily_seasonality=False,
        weekly_seasonality=True,
        yearly_seasonality=True,
        seasonality_mode='multiplicative'
    )

    # fit the model
    model.fit(history_pd)

    # configure predictions
    future_pd = model.make_future_dataframe(
        periods=90,
        freq='d',
        include_history=True
    )

    # make predictions
    results_pd = model.predict(future_pd)

    # . . .

    # return predictions
    return results_pd
我需要分组_图的原因是我需要并行运行fbprophet模型训练,用于多个商店、项目组合,如下所示

results = (
    store_item_history
    .groupBy('store', 'item')
    .apply(forecast_store_item)
    .withColumn('training_date', current_date())
    )
本问题中提到的代码取自此处:


我认为语法错误是由“@”引起的。

请显示完整的错误回溯。它可能与@无关,但与其他一些错误有关。哪一行导致了错误?@pandas\u udf(schema,functionType=PandasUDFType.GROUPED\u MAP),如果我删除@,它不会给我一个错误,但它不能解决问题。也许可以尝试删除该行,在函数定义之后,放入
预测存储\u item=pandas\u udf(预测存储项、结果模式、PandasudType.GROUPED映射)
关闭,重新打开问题。