我的熊猫数据帧
df4.head()
features
0 [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, ...
1 [0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, ...
每个单元格都是一个python列表。你知道吗
mySchema=StructType([StructField("features",ArrayType(IntegerType()),True)])
sdf2=sqlCtx.createDataFrame(df4,schema=mySchema)
在创建spark数据帧sdf2时,出现以下错误。我尝试了不同的数据类型,但没有成功。你知道吗
Error: element in array field features: IntegerType can not accept object 0 in type <class 'numpy.int64'>
我想在Pysark中运行BucketedRandomProjectionLSH,它接受带有数据向量的单个列。你知道吗
这是因为数组中有
numpy.int64
对象。你知道吗Spark不接受这一点。你知道吗
尝试改用Python
list
。你知道吗相关问题 更多 >
编程相关推荐