I would like to convert two lists to a pyspark data frame, where the lists are respective columns.
I tried
a=[1, 2, 3, 4]
b=[2, 3, 4, 5]
sqlContext.createDataFrame([a, b], schema=['a', 'b']).show()
But I got
+---+---+---+---+
| a| b| _3| _4|
+---+---+---+---+
| 1| 2| 3| 4|
| 2| 3| 4| 5|
+---+---+---+---+
What I really want is this:
+---+---+
| a| b|
+---+---+
| 1| 2|
| 2| 3|
| 3| 4|
| 4| 5|
+---+---+
Is there a convenient way to create this result?