核心问题就在这里
from pyspark.ml.feature import VectorAssembler
df = spark.createDataFrame([([1, 2, 3], 0, 3)], ["a", "b", "c"])
vecAssembler = VectorAssembler(outputCol="features", inputCols=["a", "b", "c"])
vecAssembler.transform(df).show()
有错误IllegalArgumentException: Data type array<bigint> of column a is not supported.
我知道这有点像玩具问题,但我正试图通过步骤将其集成到一个较长的管道中
如果我能为VectorAssembler确定正确的输入数据类型,我应该能够正确地将所有内容串在一起。我认为输入类型是向量,但我不知道如何构建向量
根据docs报告
因此,首先需要将数组列转换为向量列(方法来自this question)
然后可以使用向量汇编程序:
相关问题 更多 >
编程相关推荐