---
title: PySpark reference
description: "PySpark reference in PySpark: This page provides an overview of reference available for PySpark, a Python API for Spark."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/
---

# PySpark reference

This page provides an overview of reference available for PySpark, a Python API for Spark. For more information about PySpark, see [PySpark on Databricks](https://docs.databricks.com/aws/en/pyspark/index.md).

## Data types

For a complete list of PySpark data types, see [PySpark data types](https://docs.databricks.com/aws/en/pyspark/reference/datatypes.md).

## Classes

### DataFrames

| Reference                                                                                                        | Description                                                                                               |
| ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [Column](https://docs.databricks.com/aws/en/pyspark/reference/classes/column.md)                                 | Operations for working with DataFrame columns, including transformations and expressions.                 |
| [DataFrame](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframe.md)                           | Distributed collection of data organized into named columns, similar to a table in a relational database. |
| [DataFrameNaFunctions](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframenafunctions.md)     | Functionality for working with missing data in a DataFrame.                                               |
| [DataFrameReader](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframereader.md)               | Interface used to load a DataFrame from external storage systems.                                         |
| [DataFrameStatFunctions](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframestatfunctions.md) | Functionality for statistical functions with a DataFrame.                                                 |
| [DataFrameWriter](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframewriter.md)               | Interface used to write a DataFrame to external storage systems.                                          |
| [DataFrameWriterV2](https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframewriterv2.md)           | Interface used to write a DataFrame to external storage (version 2).                                      |
| [GroupedData](https://docs.databricks.com/aws/en/pyspark/reference/classes/groupeddata.md)                       | Methods for grouping data and performing aggregation operations on grouped DataFrames.                    |
| [Row](https://docs.databricks.com/aws/en/pyspark/reference/classes/row.md)                                       | Represents a row of data in a DataFrame, providing access to individual field values.                     |

### <a id="datasource" />Custom data sources

| Reference                                                                                                                    | Description                                                                                                                                                                                                       |
| ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DataSource](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasource.md)                                     | APIs for implementing custom data sources to read from external systems. For information about custom data sources, see [PySpark custom data sources](https://docs.databricks.com/aws/en/pyspark/datasources.md). |
| [DataSourceArrowWriter](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourcearrowwriter.md)               | A base class for data source writers that process data using PyArrow's `RecordBatch`.                                                                                                                             |
| [DataSourceRegistration](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourceregistration.md)             | A wrapper for data source registration.                                                                                                                                                                           |
| [DataSourceReader](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourcereader.md)                         | A base class for data source readers.                                                                                                                                                                             |
| [DataSourceStreamArrowWriter](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourcestreamarrowwriter.md)   | A base class for data stream writers that process data using PyArrow's `RecordBatch`.                                                                                                                             |
| [DataSourceStreamReader](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourcestreamreader.md)             | A base class for streaming data source readers.                                                                                                                                                                   |
| [DataSourceStreamWriter](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourcestreamwriter.md)             | A base class for data stream writers.                                                                                                                                                                             |
| [DataSourceWriter](https://docs.databricks.com/aws/en/pyspark/reference/classes/datasourcewriter.md)                         | A base class for data source writers responsible for saving data to a custom data source in batch mode.                                                                                                           |
| [InputPartition](https://docs.databricks.com/aws/en/pyspark/reference/classes/inputpartition.md)                             | A base class representing an input partition returned by the `partitions()` method of `DataSourceReader`.                                                                                                         |
| [SimpleDataSourceStreamReader](https://docs.databricks.com/aws/en/pyspark/reference/classes/simpledatasourcestreamreader.md) | A base class for simplified streaming data source readers that reads data and plans the latest offset simultaneously.                                                                                             |
| [WriterCommitMessage](https://docs.databricks.com/aws/en/pyspark/reference/classes/writercommitmessage.md)                   | A commit message returned by `DataSourceWriter.write` and sent back to the driver as an input parameter of `DataSourceWriter.commit` or `DataSourceWriter.abort`.                                                 |

### <a id="ss" />Structured Streaming

| Reference                                                                                                           | Description                                                                                     |
| ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [DataStreamReader](https://docs.databricks.com/aws/en/pyspark/reference/classes/datastreamreader.md)                | Interface used to load a streaming DataFrame from external storage systems.                     |
| [DataStreamWriter](https://docs.databricks.com/aws/en/pyspark/reference/classes/datastreamwriter.md)                | Interface used to write a streaming DataFrame to external storage systems.                      |
| [Stateful Processor](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/stateful_processor.html) | Manages state across streaming batches for complex stateful operations in structured streaming. |
| [StreamingQuery](https://docs.databricks.com/aws/en/pyspark/reference/classes/streamingquery.md)                    | A handle to a query that is executing continuously in the background as new data arrives.       |
| [StreamingQueryListener](https://docs.databricks.com/aws/en/pyspark/reference/classes/streamingquerylistener.md)    | Abstract class for listening to streaming query lifecycle events.                               |
| [StreamingQueryManager](https://docs.databricks.com/aws/en/pyspark/reference/classes/streamingquerymanager.md)      | Manages all active `StreamingQuery` instances associated with a `SparkSession`.                 |

### User-defined functions

| Reference                                                                                               | Description                                                                                          |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| [UserDefinedFunction (UDF)](https://docs.databricks.com/aws/en/pyspark/reference/classes/udf.md)        | User-defined functions for applying custom Python logic to DataFrame columns.                        |
| [UDFRegistration](https://docs.databricks.com/aws/en/pyspark/reference/classes/udfregistration.md)      | Wrapper for user-defined function registration. This instance can be accessed by `spark.udf`.        |
| [UserDefinedTableFunction (UDTF)](https://docs.databricks.com/aws/en/pyspark/reference/classes/udtf.md) | User-defined table functions that return multiple rows for each input row.                           |
| [UDTFRegistration](https://docs.databricks.com/aws/en/pyspark/reference/classes/udtfregistration.md)    | Wrapper for user-defined table function registration. This instance can be accessed by `spark.udtf`. |

### Other core classes

| Reference                                                                                       | Description                                                                                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Catalog](https://docs.databricks.com/aws/en/pyspark/reference/classes/catalog.md)              | Interface for managing databases, tables, functions, and other catalog metadata.                                                                                                                                                                                               |
| [Geography](https://docs.databricks.com/aws/en/pyspark/reference/classes/geography.md)          | A class to represent a Geography value in Python.                                                                                                                                                                                                                              |
| [Geometry](https://docs.databricks.com/aws/en/pyspark/reference/classes/geometry.md)            | A class to represent a Geometry value in Python.                                                                                                                                                                                                                               |
| [Observation](https://docs.databricks.com/aws/en/pyspark/reference/classes/observation.md)      | Collects metrics and observes DataFrames during query execution for monitoring and debugging.                                                                                                                                                                                  |
| [PlotAccessor](https://docs.databricks.com/aws/en/pyspark/reference/classes/plotaccessor.md)    | Accessor for DataFrame plotting functionality in PySpark.                                                                                                                                                                                                                      |
| [ProtoBuf](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/protobuf.html) | Support for serializing and deserializing data using Protocol Buffers format.                                                                                                                                                                                                  |
| [RuntimeConfig](https://docs.databricks.com/aws/en/pyspark/reference/classes/runtimeconfig.md)  | Runtime configuration options for Spark SQL, including execution and optimizer settings.<br />For information on configuration that is only available on Databricks, see [Set Spark configuration properties on Databricks](https://docs.databricks.com/aws/en/spark/conf.md). |
| [SparkSession](https://docs.databricks.com/aws/en/pyspark/reference/classes/sparksession.md)    | The entry point for reading data and executing SQL queries in PySpark applications.                                                                                                                                                                                            |
| [VariantVal](https://docs.databricks.com/aws/en/pyspark/reference/classes/variantval.md)        | Represents semi-structured data with flexible schema, which supports dynamic types and nested structures.                                                                                                                                                                      |
| [Window](https://docs.databricks.com/aws/en/pyspark/reference/classes/window.md)                | Window functions for performing calculations across a set of table rows related to the current row.                                                                                                                                                                            |
| [WindowSpec](https://docs.databricks.com/aws/en/pyspark/reference/classes/windowspec.md)        | Window functions for performing calculations across a set of table rows related to the current row.                                                                                                                                                                            |

## Functions

For a complete list of available built-in functions, see [PySpark functions](https://docs.databricks.com/aws/en/pyspark/reference/functions/index.md).
