ฉันกำลังสร้าง pyspark dataframe ใหม่จากรายการสตริง รหัสของฉันควรมีลักษณะอย่างไร
นี่คือรายการของฉัน: ['there', 'is', 'one', 'that', 'commands'] และนี่คือสิ่งที่ฉันต้องการในอุดมคติ:
คำ(ส่วนหัว)
แถวที่ 1: ['there', 'is', 'one', 'that', 'commands'] แถวที่ 2: ['test', 'try'
ฉันได้ลองใช้รหัสต่อไปนี้แล้ว แต่ไม่มีรหัสใดที่ให้สิ่งที่ฉันต้องการเลย
test_list=['hi','bye','thanks']
test_list=sc.parallelize(test_list)
schema = StructType([StructField("name", StringType(), True)])
df3 = sqlContext.createDataFrame(test_list, schema)
และ
test_list=['hi','bye','thanks']
test_list=sc.parallelize(test_list)
df3 = sqlContext.createDataFrame(row(test_list), schema)
ฉันไม่สามารถให้ dataframes แสดงโดยใช้ df.show()