【问题标题】:return a Pandas Series inside of pandas_udf spark在 pandas_udf spark 中返回一个 Pandas 系列
【发布时间】:2020-06-11 08:56:02
【问题描述】:

在 Apache Spark 上,我有一个应该返回 pd.Series 的 pandas_udf 函数如何存档?

我试过了:

@pandas_udf(ArrayType(LongType()), PandasUDFType.SCALAR_ITER) # Only works with spark 3.0
def udf(iterator):
  ...
  return pd.Series([1,2,3,4,5])

这给出了例外:

pyarrow.lib.ArrowNotImplementedError: NumPyConverter doesn't implement <list<item: int64>> conversion.

【问题讨论】:

  • 你能用一些示例数据分享你想要实现的目标吗?

标签: apache-spark pyspark apache-arrow


【解决方案1】:

好的,这是我这边的一个错误。来自 pandas udf 的模式类型

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-14
    • 2022-01-26
    • 1970-01-01
    • 2018-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多