tmp = dict(list(vs) + [('a', k)])
return Row(**{k: tmp.get(k, 0) for k in ['a'] + majors})
reshaped2 = sqlContext.createDataFrame(grouped.map(make_row))
reshaped2.show()
Spark dataframe transform multiple rows to column