---
title: show
description: "DataFrame.show method in PySpark: Prints the first n rows of the DataFrame to the console."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframe/show
---

# show

Prints the first `n` rows of the DataFrame to the console.

## Syntax

```
show(n: int = 20, truncate: Union[bool, int] = True, vertical: bool = False)
```

## Parameters

| Parameter  | Type                                | Description                                                                                                                                                      |
| ---------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `n`        | int, optional, default 20           | Number of rows to show.                                                                                                                                          |
| `truncate` | bool or int, optional, default True | If set to `True`, truncate strings longer than 20 chars. If set to a number greater than one, truncates long strings to length `truncate` and align cells right. |
| `vertical` | bool, optional                      | If set to `True`, print output rows vertically (one line per column value).                                                                                      |

## Examples

```python
df = spark.createDataFrame([
    (14, "Tom"), (23, "Alice"), (16, "Bob"), (19, "This is a super long name")],
    ["age", "name"])

df.show()
# +---+--------------------+
# |age|                name|
# +---+--------------------+
# | 14|                 Tom|
# | 23|               Alice|
# | 16|                 Bob|
# | 19|This is a super l...|
# +---+--------------------+

df.show(2)
# +---+-----+
# |age| name|
# +---+-----+
# | 14|  Tom|
# | 23|Alice|
# +---+-----+
# only showing top 2 rows

df.show(truncate=False)
# +---+-------------------------+
# |age|name                     |
# +---+-------------------------+
# |14 |Tom                      |
# |23 |Alice                    |
# |16 |Bob                      |
# |19 |This is a super long name|
# +---+-------------------------+

df.show(truncate=3)
# +---+----+
# |age|name|
# +---+----+
# | 14| Tom|
# | 23| Ali|
# | 16| Bob|
# | 19| Thi|
# +---+----+

df.show(vertical=True)
# -RECORD 0--------------------
# age  | 14
# name | Tom
# -RECORD 1--------------------
# age  | 23
# name | Alice
# -RECORD 2--------------------
# age  | 16
# name | Bob
# -RECORD 3--------------------
# age  | 19
# name | This is a super l...
```
