i have a dataframe, called pydf.
How do i save this as a table within databricks? I tried pydf.write and I get the message "DataFrame object has no attribute write"
So how do i save this then?
CodePudding user response:
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
spark_df = spark.createDataFrame(pydf)
spark_df.write.mode("overwrite").saveAsTable("example")