【发布时间】:2018-10-01 07:13:26
【问题描述】:
我想使用以下代码在 PySpark 中创建一个 Dataframe
from pyspark.sql import *
from pyspark.sql.types import *
temp = Row("DESC", "ID")
temp1 = temp('Description1323', 123)
print temp1
schema = StructType([StructField("DESC", StringType(), False),
StructField("ID", IntegerType(), False)])
df = spark.createDataFrame(temp1, schema)
但我收到以下错误:
TypeError: StructType 不能接受类型中的对象“Description1323” 输入'str'
我的代码有什么问题?
【问题讨论】:
标签: python apache-spark pyspark databricks