我试图将新行添加到数据框,但不能。
我的代码:
newRow = Row(id='ID123')
newDF= df.insertInto(newRow)
or
newDF= df.union(newRow)
错误:
AttributeError: _jdf
AttributeError: 'DataFrame' object has no attribute 'insertInto'
尝试:(文档)
from pyspark.sql import Row
newDf = sc.parallelize([Row(id='ID123')]).toDF()
newDF.show()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句