Databricks Notes
Tips and tricks for using databricks platform
Using external files in databricks community edition
In this section, I am going to provide information on how to add external files in databricks community edition and then use these files in notebooks. For the demo, we are going to use Auto-mpg dataset](https://www.kaggle.com/datasets/uciml/autompg-dataset?resource=download).
- Download the Auto-mpg dataset dataset from Kaggle.
- The donwloaded file will be a zip file so extract it to obtain
auto_mpg.csv
. - Log in to databricks community edition.
- After login, click on the Data section from the left side navigation bar.
- In the sub menu, click on the Create Table button.
- You will be navigated to Create New Table UI.
- Insert the directory name and then upload the file(s) that needs to be uploaded.
- Navigate to a notebook and use the code snippet below to use the uploaded file.
df = spark.read.format("csv").option("header", True).load("/FileStore/tables/auto-mpg/auto_mpg.csv")
display(df)
The above command will create a dataframe from the file we uploaded.
Share this post
Twitter
Reddit
LinkedIn
Pinterest
Email