I need to create a CSV output file that lists the minimum price, maximum price, and total row count from a data set. The expected output (CSV file) should have as column names: min_price, max_price and total_rows. How can I merge the output I have into a dataframe and then save it as CSV with these three columns?
So far I have done:
df=spark.read.parquet('mydataframe', inferSchema=True)
price=df.select('price')
max=df.agg({'price': 'max'}).show()
min=df.agg({'price': 'min'}).show()
df.count()