concept show() in category pyspark

appears as: show()
Data Analysis with Python and PySpark

This is an excerpt from Manning's book Data Analysis with Python and PySpark.

Enter the show() method.

The show() method displays a sample of the data back to you. Nothing more, nothing less. With printSchema(), it will become one of your best friend to perform data exploration and validation. By default, it will show 20 rows and truncate long rows. The code in listing 2.7 shows the default behaviour of the method, applied to our book data frame. For text data, the length limitation is limiting (pun intended). Fortunately, show() provides some options to display just what you need.

Listing 2.7. Showing a little data using the .show() method.
book.show()

# +--------------------+
# |               value|
# +--------------------+
# |The Project Guten...|
# |                    |
# |This eBook is for...|
# |almost no restric...|
# |re-use it under t...|
# |with this eBook o...|
# |                    |
# |                    |
# |Title: Pride and ...|
# |                    |
# | Author: Jane Austen|
# |                    |
# |Posting Date: Aug...|
# |Release Date: Jun...|
# |Last Updated: Mar...|
# |                    |
# |   Language: English|
# |                    |
# |Character set enc...|
# |                    |
# +--------------------+
# only showing top 20 rows

The show() method takes three optional parameters.

Figure 3.2. A distributed group by on our words_nonull data frame. The work is performed in a distributed fashion until we need to assemble the results in a cohesive display, via show().
ch03 distributed groupby