这里不需要UDF。列已提供cast方法和datatype实例: frompyspark.sql.typesimportDoubleType changedTypedf = joindf.withColumn("label", joindf["show"].cast(DoubleType())) 或短字符串: changedTypedf = joindf.withColumn("label", joindf["show"].cast("double")) ...
这里不需要UDF。Column已经提供了cast方法和DataType* 示例 *:
# 需要导入模块: from pyspark.sql import types [as 别名]# 或者: from pyspark.sql.types importDoubleType[as 别名]def_transform(self, dataset):ifany([field.dataType ==DoubleType()forfieldindataset.schema]): logger.warning("DetectedDoubleTypecolumns in dataframe passed to transform(). In ""Dee...