---
title: tail
description: "DataFrame.tail method in PySpark: Returns the last num rows as a list of Row."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/dataframe/tail
---

# tail

Returns the last `num` rows as a list of `Row`.

## Syntax

```
tail(num: int)
```

## Parameters

| Parameter | Type | Description                                                                                                                                |
| --------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `num`     | int  | Number of records to return. Will return this number of records or all records if the DataFrame contains less than this number of records. |

## Returns

list: List of rows.

## Notes

Running tail requires moving data into the application's driver process, and doing so with a very large `num` can crash the driver process with OutOfMemoryError.

## Examples

```python
df = spark.createDataFrame(
    [(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])

df.tail(2)
# [Row(age=23, name='Alice'), Row(age=16, name='Bob')]
```
