|
|
飞奔的莲藕 · 千年妈祖在莆田,越来越好_手机新浪网· 1 年前 · |
|
|
多情的葡萄酒 · 窦文涛忆与凤凰女主播“四段情”:鲁豫是同甘之 ...· 1 年前 · |
|
|
呐喊的打火机 · 王者荣耀新英雄沈梦溪怎么得新英雄沈梦溪多少钱 ...· 3 年前 · |
|
|
咆哮的木瓜 · 《蜀锦人家》全集-电视剧-免费在线观看· 3 年前 · |
Prints the first
n
rows of the DataFrame to the console.
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
Number of rows to show.
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.
If set to
True
, print output rows vertically (one line per column value).
Examples
>>> df = spark.createDataFrame([
... (14, "Tom"), (23, "Alice"), (16, "Bob"), (19, "This is a super long name")],
... ["age", "name"])
Show DataFrame
>>> df.show()
+---+--------------------+
|age| name|
+---+--------------------+
| 14| Tom|
| 23| Alice|
| 16| Bob|
| 19|This is a super l...|
+---+--------------------+
Show only top 2 rows.
>>> df.show(2)
+---+-----+
|age| name|
+---+-----+
| 14| Tom|
| 23|Alice|
+---+-----+
only showing top 2 rows
Show full column content without truncation.
>>> df.show(truncate=False)
+---+-------------------------+
|age|name |
+---+-------------------------+
|14 |Tom |
|23 |Alice |
|16 |Bob |
|19 |This is a super long name|
+---+-------------------------+
Show DataFrame where the maximum number of characters is 3.
>>> df.show(truncate=3)
+---+----+
|age|name|
+---+----+
| 14| Tom|
| 23| Ali|
| 16| Bob|
| 19| Thi|
+---+----+
Show DataFrame vertically.
>>> 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...