【发布时间】:2019-05-19 20:20:27
【问题描述】:
当我使用UDF处理一个Column时,我不确定UDF是不是一个一个处理这个列中的元素?如果是这样,我无法理解为什么会出现问题。
import pyspark.sql.types as typ
from pyspark.sql.functions import udf,pandas_udf, PandasUDFType
def parse_model(v):
return v.split(' ')
Parse_model=pandas_udf(parse_model,typ.ArrayType(typ.StringType(),True))
sample_data_df.withColumn('Models',Parse_model('Model')).show(
应该是 细绳 在列中而不是系列中。
AttributeError: 'Series' object has no attribute 'split'
【问题讨论】:
标签: pandas pyspark user-defined-functions