pyspark将新行添加到数据框

希拉

我试图将新行添加到数据框,但不能。

我的代码:

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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章