pyspark.sql.DataFrame.show¶
-
DataFrame.
show
(n: int = 20, truncate: Union[bool, int] = True, vertical: bool = False) → None¶ Prints the first
n
rows to the console.- Parameters
- nint, optional
Number of rows to show.
- truncatebool or int, optional
If set to
True
, truncate strings longer than 20 chars by default. If set to a number greater than one, truncates long strings to lengthtruncate
and align cells right.- verticalbool, optional
If set to
True
, print output rows vertically (one line per column value).
Examples
>>> df DataFrame[age: int, name: string] >>> df.show() +---+-----+ |age| name| +---+-----+ | 2|Alice| | 5| Bob| +---+-----+ >>> df.show(truncate=3) +---+----+ |age|name| +---+----+ | 2| Ali| | 5| Bob| +---+----+ >>> df.show(vertical=True) -RECORD 0----- age | 2 name | Alice -RECORD 1----- age | 5 name | Bob