I am trying to add a new row to dataframe but cant.
my code:
newRow = Row(id='ID123')
newDF= df.insertInto(newRow)
or
newDF= df.union(newRow)
errors:
AttributeError: _jdf
AttributeError: 'DataFrame' object has no attribute 'insertInto'
Simple way to add row in dataframe using pyspark
newRow = spark.createDataFrame([(15,'Alk','Dhl')])
df = df.union(newRow)
df.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With