我在PySpark中有这个RDD,我想创建一个模式。
收集到的1行RDD示例:
(('16/12/2006', '17:24:00', 4.216, 0.418, 234.84, 18.4, 0.0, 1.0, 17.0), 0)customSchema = StructType([
StructField("Date", StringType(), True),
StructField("Hour", StringType(), True),
StructField("ActivePower", FloatType(), True),
StructField("ReactivePower", FloatType(), True),
StructField("Voltage", FloatType(), True),
StructField("Instensity", FloatType(), True),
StructField("Sub1", FloatType(), True),
StructField("Sub2", FloatType(), True),
StructField("Sub3", FloatType(), True),
StructField("ID", IntegerType(), True)])问题是索引(最后一个零)不在数据元组中,我不知道如何正确地创建模式。
提前谢谢你。
https://stackoverflow.com/questions/44555879
复制相似问题