Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export data from a dataframe to a file databricks

I'm doing right now Introduction to Spark course at EdX. Is there a possibility to save dataframes from Databricks on my computer.

I'm asking this question, because this course provides Databricks notebooks which probably won't work after the course.

In the notebook data is imported using command:

log_file_path = 'dbfs:/' + os.path.join('databricks-datasets', 'cs100', 'lab2', 'data-001', 'apache.access.log.PROJECT')

I found this solution but it doesn't work:

df.select('year','model').write.format('com.databricks.spark.csv').save('newcars.csv')

like image 483
Tom Becker Avatar asked Jul 27 '16 17:07

Tom Becker


1 Answers

Databricks runs a cloud VM and does not have any idea where your local machine is located. If you want to save the CSV results of a DataFrame, you can run display(df) and there's an option to download the results.

enter image description here

like image 151
MrChristine Avatar answered Nov 04 '22 02:11

MrChristine