---
title: "Tutorial: Load and transform data using Apache Spark DataFrames"
description: Learn how to load and transform data using the Apache Spark Python (PySpark) DataFrame API, the Apache Spark Scala DataFrame API, and the SparkR SparkDataFrame API in Databricks.
canonical_url: https://docs.databricks.com/aws/en/getting-started/dataframes
---

# Tutorial: Load and transform data using Apache Spark DataFrames

This tutorial shows you how to load and transform data using the Apache Spark Python (PySpark) DataFrame API, the Apache Spark Scala DataFrame API, and the SparkR SparkDataFrame API in Databricks.

> [!NOTE]
>
> If you are using [Databricks Free Edition](https://docs.databricks.com/aws/en/getting-started/free-edition-limitations.md), select the **Python** tab for all code examples in this tutorial. Free Edition does not support R or Scala. Additionally, Free Edition restricts outbound internet access, so you must upload the CSV file using the workspace UI instead of downloading it with code. See [Step 1](https://docs.databricks.com/aws/en/getting-started/dataframes.md#define-variables) for detailed instructions.

By the end of this tutorial, you will understand what a [DataFrame](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframe.md) is and be familiar with the following tasks:

## Python

* [Define variables and copy public data into a Unity Catalog volume](https://docs.databricks.com/aws/en/getting-started/dataframes.md#define-variables)
* [Create a DataFrame with Python](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe)
* [Load data into a DataFrame from CSV file](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe-from-csv)
* [View and interact with a DataFrame](https://docs.databricks.com/aws/en/getting-started/dataframes.md#interact-with-dataframe)
* [Save the DataFrame](https://docs.databricks.com/aws/en/getting-started/dataframes.md#save-dataframe)
* [Run SQL queries in PySpark](https://docs.databricks.com/aws/en/getting-started/dataframes.md#run-sql)

See also [Apache Spark PySpark API reference](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframe.md).

## Scala

* [Define variables and copy public data into a Unity Catalog volume](https://docs.databricks.com/aws/en/getting-started/dataframes.md#define-variables)
* [Create a DataFrame with Scala](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe)
* [Load data into a DataFrame from CSV file](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe-from-csv)
* [View and interacting with a DataFrame](https://docs.databricks.com/aws/en/getting-started/dataframes.md#interact-with-dataframe)
* [Save the DataFrame](https://docs.databricks.com/aws/en/getting-started/dataframes.md#save-dataframe)
* [Run SQL queries in Apache Spark](https://docs.databricks.com/aws/en/getting-started/dataframes.md#run-sql)

See also [Apache Spark Scala API reference](https://spark.apache.org/docs/latest/api/scala/org/apache/spark/index.html).

## R

* [Define variables and copy public data into a Unity Catalog volume](https://docs.databricks.com/aws/en/getting-started/dataframes.md#define-variables)
* [Create a SparkR SparkDataFrames](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe)
* [Load data into a DataFrame from CSV file](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe-from-csv)
* [View and interact with a DataFrame](https://docs.databricks.com/aws/en/getting-started/dataframes.md#interact-with-dataframe)
* [Save the DataFrame](https://docs.databricks.com/aws/en/getting-started/dataframes.md#save-dataframe)
* [Run SQL queries in SparkR](https://docs.databricks.com/aws/en/getting-started/dataframes.md#run-sql)

See also [Apache SparkR API reference](https://spark.apache.org/docs/latest/sparkr.html#sparkdataframe).

## <a id="what-is-dataframe" />What is a DataFrame?

A DataFrame is a two-dimensional labeled data structure with columns of potentially different types. You can think of a DataFrame like a spreadsheet, a SQL table, or a dictionary of series objects. Apache Spark DataFrames provide a rich set of functions (select columns, filter, join, aggregate) that allow you to solve common data analysis problems efficiently.

Apache Spark DataFrames are an abstraction built on top of Resilient Distributed Datasets (RDDs). Spark DataFrames and Spark SQL use a unified planning and optimization engine, allowing you to get nearly identical performance across all supported languages on Databricks (Python, SQL, Scala, and R).

## Requirements

To complete the following tutorial, you must meet the following requirements:

* To use the examples in this tutorial, your workspace must have [Unity Catalog](https://docs.databricks.com/aws/en/data-governance/unity-catalog/index.md) enabled. Databricks Free Edition and free trial workspaces have Unity Catalog enabled by default.
* The examples in this tutorial use a Unity Catalog [volume](https://docs.databricks.com/aws/en/volumes/index.md) to store sample data. To use these examples, create a volume and use that volume's catalog, schema, and volume names to set the volume path used by the examples. Free Edition users have access to the workspace catalog and the `default` schema by default.
* You must have the following permissions in Unity Catalog:

  * `READ VOLUME` and `WRITE VOLUME` for the volume used for this tutorial
  * `USE SCHEMA` for the schema used for this tutorial
  * `USE CATALOG` for the catalog used for this tutorial

  To set these permissions, see your Databricks administrator or [Unity Catalog privileges reference](https://docs.databricks.com/aws/en/data-governance/unity-catalog/access-control/privileges-reference.md). Free Edition users have these privileges on the workspace catalog and `default` schema by default.

> [!TIP]
>
> For a completed notebook for this article, see [DataFrame tutorial notebooks](https://docs.databricks.com/aws/en/getting-started/dataframes.md#notebook).

## <a id="define-variables" />Step 1: Define variables and load CSV file

This step defines variables for use in this tutorial and then loads a CSV file containing baby name data from [health.data.ny.gov](https://health.data.ny.gov/api/views/jxy9-yhdk/rows.csv) into your Unity Catalog volume. You need the names of a Unity Catalog catalog, schema, and volume.

> [!TIP]
>
> If you don't know your catalog and schema names, click ![Data icon.](https://docs.databricks.com/aws/en/images/product-icons/DataIcon.svg) **Catalog** in the sidebar. The workspace catalog shares a name with your workspace and is listed in the catalog panel. Expand it to see available schemas. Free Edition and free trial users can use the workspace catalog and the `default` schema.
>
> If you don't have a volume, create one by running the following command in a notebook cell (replace `<catalog_name>` and `<schema_name>` with your values):
>
> ```sql
> CREATE VOLUME IF NOT EXISTS <catalog_name>.<schema_name>.my_volume
> ```

1. Open a new notebook by clicking the ![New Icon](https://docs.databricks.com/aws/en/images/icons/create-icon.png) icon. To learn how to navigate Databricks notebooks, see [Customize Databricks notebook appearance](https://docs.databricks.com/aws/en/notebooks/notebook-ui.md).

2. Copy and paste the following code into the new empty notebook cell. Replace `<catalog-name>`, `<schema-name>`, and `<volume-name>` with the catalog, schema, and volume names for a Unity Catalog volume. Replace `<table_name>` with a table name of your choice. You load baby name data into this table later in this tutorial.

   ### Python

   ```python
   catalog = "<catalog_name>"
   schema = "<schema_name>"
   volume = "<volume_name>"
   download_url = "https://health.data.ny.gov/api/views/jxy9-yhdk/rows.csv"
   file_name = "rows.csv"
   table_name = "<table_name>"
   path_volume = "/Volumes/" + catalog + "/" + schema + "/" + volume
   path_table = catalog + "." + schema
   print(path_table) # Show the complete path
   print(path_volume) # Show the complete path
   ```

   ### Scala

   ```scala
   val catalog = "<catalog_name>"
   val schema = "<schema_name>"
   val volume = "<volume_name>"
   val downloadUrl = "https://health.data.ny.gov/api/views/jxy9-yhdk/rows.csv"
   val fileName = "rows.csv"
   val tableName = "<table_name>"
   val pathVolume = s"/Volumes/$catalog/$schema/$volume"
   val pathTable = s"$catalog.$schema"
   print(pathVolume) // Show the complete path
   print(pathTable) // Show the complete path
   ```

   ### R

   ```r
   catalog <- "<catalog_name>"
   schema <- "<schema_name>"
   volume <- "<volume_name>"
   download_url <- "https://health.data.ny.gov/api/views/jxy9-yhdk/rows.csv"
   file_name <- "rows.csv"
   table_name <- "<table_name>"
   path_volume <- paste("/Volumes/", catalog, "/", schema, "/", volume, sep = "")
   path_table <- paste(catalog, ".", schema, sep = "")
   print(path_volume) # Show the complete path
   print(path_table) # Show the complete path
   ```

3. Press `Shift+Enter` to run the cell and create a new blank cell.

4. Load the CSV file into your volume. Choose one of the following methods:

   * **Upload using the workspace UI** — Use this method if you are on [Databricks Free Edition](https://docs.databricks.com/aws/en/getting-started/free-edition-limitations.md), or if the code download in option B fails with a network error. Free Edition and other serverless compute environments restrict outbound internet access, so you must upload the file from your local machine.
   * **Download using code** — Use this method if your compute environment has outbound internet access.

   **Option A: Upload using the workspace UI**

   1. On your local machine, open [health.data.ny.gov/api/views/jxy9-yhdk/rows.csv](https://health.data.ny.gov/api/views/jxy9-yhdk/rows.csv) in your browser. The file downloads to your computer as `rows.csv`, which matches the `file_name` variable defined previously.
   2. Go back to your Databricks workspace. In the sidebar, click ![New Icon](https://docs.databricks.com/aws/en/images/icons/create-icon.png) **New > Add or upload data**.
   3. Click **Upload files to a volume**.
   4. Click **browse** and select the `rows.csv` file, or drag and drop it into the upload area.
   5. Under **Destination volume**, select the volume you specified above.
   6. After the upload finishes, return to your notebook and continue with [Step 2](https://docs.databricks.com/aws/en/getting-started/dataframes.md#create-dataframe).

   For more details about uploading files, see [Work with files in Unity Catalog volumes](https://docs.databricks.com/aws/en/volumes/volume-files.md).

   **Option B: Download using code**

   Copy and paste the following code into the new empty notebook cell. This code copies the `rows.csv` file from [health.data.ny.gov](https://health.data.ny.gov/api/views/jxy9-yhdk/rows.csv) into your Unity Catalog volume using the [Databricks dbutils](https://docs.databricks.com/aws/en/dev-tools/databricks-utils.md#cp-command-dbutilsfscp) command. Press `Shift+Enter` to run the cell and then move to the next cell.

   ### Python

   ```python
   dbutils.fs.cp(f"{download_url}", f"{path_volume}/{file_name}")
   ```

   ### Scala

   ```scala
   dbutils.fs.cp(downloadUrl, s"$pathVolume/$fileName")
   ```

   ### R

   ```r
   dbutils.fs.cp(download_url, paste(path_volume, "/", file_name, sep = ""))
   ```

## <a id="create-dataframe" />Step 2: Create a DataFrame

This step creates a DataFrame named `df1` with test data and then displays its contents.

1. Copy and paste the following code into the new empty notebook cell. This code creates the DataFrame with test data, and then displays the contents and the schema of the DataFrame.

   ### Python

   ```python
   data = [[2021, "test", "Albany", "M", 42]]
   columns = ["Year", "First_Name", "County", "Sex", "Count"]

   # highlight-next-line
   df1 = spark.createDataFrame(data, schema="Year int, First_Name STRING, County STRING, Sex STRING, Count int")
   display(df1) # The display() method is specific to Databricks notebooks and provides a richer visualization.
   # df1.show() The show() method is a part of the Apache Spark DataFrame API and provides basic visualization.
   ```

   ### Scala

   ```scala
   val data = Seq((2021, "test", "Albany", "M", 42))
   val columns = Seq("Year", "First_Name", "County", "Sex", "Count")

   // highlight-next-line
   val df1 = data.toDF(columns: _*)
   display(df1) // The display() method is specific to Databricks notebooks and provides a richer visualization.
   // df1.show() The show() method is a part of the Apache Spark DataFrame API and provides basic visualization.
   ```

   ### R

   ```r
   # Load the SparkR package that is already preinstalled on the cluster.
   library(SparkR)

   data <- data.frame(
     Year = as.integer(c(2021)),
     First_Name = c("test"),
     County = c("Albany"),
     Sex = c("M"),
     Count = as.integer(c(42))
   )

   # highlight-next-line
   df1 <- createDataFrame(data)
   display(df1) # The display() method is specific to Databricks notebooks and provides a richer visualization.
   # head(df1) The head() method is a part of the Apache SparkR DataFrame API and provides basic visualization.
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

## <a id="create-dataframe-from-csv" />Step 3: Load data into a DataFrame from CSV file

This step creates a DataFrame named `df_csv` from the CSV file that you previously loaded into your Unity Catalog volume. See [spark.read.csv](https://spark.apache.org/docs/latest/sql-data-sources-csv.html).

1. Copy and paste the following code into the new empty notebook cell. This code loads baby name data into DataFrame `df_csv` from the CSV file and then displays the contents of the DataFrame.

   ### Python

   ```python
   df_csv = spark.read.csv(f"{path_volume}/{file_name}",
       header=True,
       inferSchema=True,
       sep=",")
   display(df_csv)
   ```

   ### Scala

   ```scala
   val dfCsv = spark.read
       .option("header", "true")
       .option("inferSchema", "true")
       .option("delimiter", ",")
       .csv(s"$pathVolume/$fileName")

   display(dfCsv)
   ```

   ### R

   ```r
   df_csv <- read.df(paste(path_volume, "/", file_name, sep=""),
       source="csv",
       header = TRUE,
       inferSchema = TRUE,
       delimiter = ",")

   display(df_csv)
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

You can load data from many [supported file formats](https://docs.databricks.com/aws/en/query/formats/index.md).

## <a id="interact-with-dataframe" />Step 4: View and interact with your DataFrame

View and interact with your baby names DataFrames using the following methods.

### Print the DataFrame schema

Learn how to display the schema of an Apache Spark DataFrame. Apache Spark uses the term *schema* to refer to the names and data types of the columns in the DataFrame.

> [!NOTE]
>
> Databricks also uses the term schema to describe a collection of tables registered to a catalog.

1. Copy and paste the following code into an empty notebook cell. This code shows the schema of your DataFrames with the `.printSchema()` method to view the schemas of the two DataFrames - to prepare to union the two DataFrames.

   #### Python

   ```python
   df_csv.printSchema()
   df1.printSchema()
   ```

   #### Scala

   ```scala
   dfCsv.printSchema()
   df1.printSchema()
   ```

   #### R

   ```r
   printSchema(df_csv)
   printSchema(df1)
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Rename column in the DataFrame

Learn how to rename a column in a DataFrame.

1. Copy and paste the following code into an empty notebook cell. This code renames a column in the `df1_csv` DataFrame to match the respective column in the `df1` DataFrame. This code uses the Apache Spark `withColumnRenamed()` method.

   #### Python

   ```python
   df_csv = df_csv.withColumnRenamed("First Name", "First_Name")
   df_csv.printSchema()
   ```

   #### Scala

   ```scala
   val dfCsvRenamed = dfCsv.withColumnRenamed("First Name", "First_Name")
   // when modifying a DataFrame in Scala, you must assign it to a new variable
   dfCsvRenamed.printSchema()
   ```

   #### R

   ```r
   df_csv <- withColumnRenamed(df_csv, "First Name", "First_Name")
   printSchema(df_csv)
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Combine DataFrames

Learn how to create a new DataFrame that adds the rows of one DataFrame to another.

1. Copy and paste the following code into an empty notebook cell. This code uses the Apache Spark `union()` method to combine the contents of your first DataFrame `df` with DataFrame `df_csv` containing the baby names data loaded from the CSV file.

   #### Python

   ```python
   df = df1.union(df_csv)
   display(df)
   ```

   #### Scala

   ```scala
   val df = df1.union(dfCsvRenamed)
   display(df)
   ```

   #### R

   ```r
   display(df <- union(df1, df_csv))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Filter rows in a DataFrame

Discover the most popular baby names in your data set by filtering rows, using the Apache Spark `.filter()` or `.where()` methods. Use filtering to select a subset of rows to return or modify in a DataFrame. There is no difference in performance or syntax, as seen in the following examples.

#### Using .filter() method

1. Copy and paste the following code into an empty notebook cell. This code uses the Apache Spark `.filter()` method to display those rows in the DataFrame with a count of more than 50.

   ##### Python

   ```python
   display(df.filter(df["Count"] > 50))
   ```

   ##### Scala

   ```scala
   display(df.filter(df("Count") > 50))
   ```

   ##### R

   ```r
   display(filteredDF <- filter(df, df$Count > 50))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

#### Using .where() method

1. Copy and paste the following code into an empty notebook cell. This code uses the Apache Spark `.where()` method to display those rows in the DataFrame with a count of more than 50.

   ##### Python

   ```python
   display(df.where(df["Count"] > 50))
   ```

   ##### Scala

   ```scala
   display(df.where(df("Count") > 50))
   ```

   ##### R

   ```r
   display(filtered_df <- where(df, df$Count > 50))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Select columns from a DataFrame and order by frequency

Learn about which baby name frequency with the `select()` method to specify the columns from the DataFrame to return. Use the Apache Spark `orderby` and `desc` functions to order the results.

The pyspark.sql module for Apache Spark provides support for SQL functions. Among these functions that we use in this tutorial are the Apache Spark `orderBy()`, `desc()`, and `expr()` functions. You enable the use of these functions by importing them into your session as needed.

1. Copy and paste the following code into an empty notebook cell. This code imports the `desc()` function and then uses the Apache Spark `select()` method and Apache Spark `orderBy()` and `desc()` functions to display the most common names and their counts in descending order.

   #### Python

   ```python
   from pyspark.sql.functions import desc
   display(df.select("First_Name", "Count").orderBy(desc("Count")))
   ```

   #### Scala

   ```scala
   import org.apache.spark.sql.functions.desc
   display(df.select("First_Name", "Count").orderBy(desc("Count")))
   ```

   #### R

   ```r
   display(arrange(select(df, df$First_Name, df$Count), desc(df$Count)))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Create a subset DataFrame

Learn how to create a subset DataFrame from an existing DataFrame.

1. Copy and paste the following code into an empty notebook cell. This code uses the Apache Spark `filter` method to create a new DataFrame restricting the data by year, count, and sex. It uses the Apache Spark `select()` method to limit the columns. It also uses the Apache Spark `orderBy()` and `desc()` functions to sort the new DataFrame by count.

   #### Python

   ```python
   subsetDF = df.filter((df["Year"] == 2009) & (df["Count"] > 100) & (df["Sex"] == "F")).select("First_Name", "County", "Count").orderBy(desc("Count"))
   display(subsetDF)
   ```

   #### Scala

   ```scala
   val subsetDF = df.filter((df("Year") === 2009) && (df("Count") > 100) && (df("Sex") === "F")).select("First_Name", "County", "Count").orderBy(desc("Count"))

   display(subsetDF)
   ```

   #### R

   ```r
   subsetDF <- select(filter(df, (df$Count > 100) & (df$year == 2009) & df["Sex"] == "F")), "First_Name", "County", "Count")
   display(subsetDF)
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

## <a id="save-dataframe" />Step 5: Save the DataFrame

Learn how to save a DataFrame,. You can either save your DataFrame to a table or write the DataFrame to a file or multiple files.

### Save the DataFrame to a table

Databricks uses the Delta Lake format for all tables by default. To save your DataFrame, you must have `CREATE` table privileges on the catalog and schema.

1. Copy and paste the following code into an empty notebook cell. This code saves the contents of the DataFrame to a table using the variable you defined at the start of this tutorial.

   #### Python

   ```python
   df.write.mode("overwrite").saveAsTable(f"{path_table}.{table_name}")
   ```

   #### Scala

   ```scala
   df.write.mode("overwrite").saveAsTable(s"$pathTable" + "." + s"$tableName")
   ```

   #### R

   ```r
   saveAsTable(df, paste(path_table, ".", table_name), mode = "overwrite")
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

Most Apache Spark applications work on large data sets and in a distributed fashion. Apache Spark writes out a directory of files rather than a single file. Delta Lake splits the Parquet folders and files. Many data systems can read these directories of files. Databricks recommends using tables over file paths for most applications.

### Save the DataFrame to JSON files

1. Copy and paste the following code into an empty notebook cell. This code saves the DataFrame to a directory of JSON files.

   #### Python

   ```python
   df.write.format("json").mode("overwrite").save("/tmp/json_data")
   ```

   #### Scala

   ```scala
   df.write.format("json").mode("overwrite").save("/tmp/json_data")
   ```

   #### R

   ```r
   write.df(df, path = "/tmp/json_data", source = "json", mode = "overwrite")
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Read the DataFrame from a JSON file

Learn how to use the Apache Spark `spark.read.format()` method to read JSON data from a directory into a DataFrame.

1. Copy and paste the following code into an empty notebook cell. This code displays the JSON files you saved in the previous example.

   #### Python

   ```python
   display(spark.read.format("json").json("/tmp/json_data"))
   ```

   #### Scala

   ```scala
   display(spark.read.format("json").json("/tmp/json_data"))
   ```

   #### R

   ```r
   display(read.json("/tmp/json_data"))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

## <a id="run-sql" />Additional tasks: Run SQL queries in PySpark, Scala, and R

Apache Spark DataFrames provide the following options to combine SQL with PySpark, Scala, and R. You can run the following code in the same notebook that you created for this tutorial.

### Specify a column as a SQL query

Learn how to use the Apache Spark `selectExpr()` method. This is a variant of the `select()` method that accepts SQL expressions and return an updated DataFrame. This method allows you to use a SQL expression, such as `upper`.

1. Copy and paste the following code into an empty notebook cell. This code uses the Apache Spark `selectExpr()` method and the SQL `upper` expression to convert a string column to upper case (and rename the column).

   #### Python

   ```python
   display(df.selectExpr("Count", "upper(County) as big_name"))
   ```

   #### Scala

   ```scala
   display(df.selectExpr("Count", "upper(County) as big_name"))
   ```

   #### R

   ```r
   display(df_selected <- selectExpr(df, "Count", "upper(County) as big_name"))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Use `expr()` to use SQL syntax for a column

Learn how to import and use the Apache Spark `expr()` function to use SQL syntax anywhere a column would be specified.

1. Copy and paste the following code into an empty notebook cell. This code imports the `expr()` function and then uses the Apache Spark `expr()` function and the SQL `lower` expression to convert a string column to lower case (and rename the column).

   #### Python

   ```python
   from pyspark.sql.functions import expr
   display(df.select("Count", expr("lower(County) as little_name")))
   ```

   #### Scala

   ```scala
   import org.apache.spark.sql.functions.{col, expr}
   // Scala requires us to import the col() function as well as the expr() function

   display(df.select(col("Count"), expr("lower(County) as little_name")))
   ```

   #### R

   ```r
   display(df_selected <- selectExpr(df, "Count", "lower(County) as little_name"))
   # expr() function is not supported in R, selectExpr in SparkR replicates this functionality
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

### Run an arbitrary SQL query using spark.sql() function

Learn how to use the Apache Spark `spark.sql()` function to run arbitrary SQL queries.

1. Copy and paste the following code into an empty notebook cell. This code uses the Apache Spark `spark.sql()` function to query a SQL table using SQL syntax.

   #### Python

   ```python
   display(spark.sql(f"SELECT * FROM {path_table}.{table_name}"))
   ```

   #### Scala

   ```scala
   display(spark.sql(s"SELECT * FROM $pathTable.$tableName"))
   ```

   #### R

   ```r
   display(sql(paste("SELECT * FROM", path_table, ".", table_name)))
   ```

2. Press `Shift+Enter` to run the cell and then move to the next cell.

## <a id="notebook" />DataFrame tutorial notebooks

The following notebooks include the examples queries from this tutorial.

### Python

#### DataFrames tutorial using Python

[Get notebook](https://docs.databricks.com/notebooks/source/getting-started/tutorial-uc-spark-dataframe-python.html)

### Scala

#### DataFrames tutorial using Scala

[Get notebook](https://docs.databricks.com/notebooks/source/getting-started/tutorial-uc-spark-dataframe-scala.html)

### R

#### DataFrames tutorial using R

[Get notebook](https://docs.databricks.com/notebooks/source/getting-started/tutorial-uc-spark-dataframe-sparkr.html)

## Additional resources

* [PySpark on Databricks](https://docs.databricks.com/aws/en/pyspark/index.md)
* [Reference for Apache Spark APIs](https://docs.databricks.com/aws/en/reference/spark.md)
* [Convert between PySpark and pandas DataFrames](https://docs.databricks.com/aws/en/pandas/pyspark-pandas-conversion.md)
* [Pandas API on Spark](https://docs.databricks.com/aws/en/pandas/pandas-on-spark.md)
