Overview of DataFrame actions
Transformations listed in the previous recipe transform one DataFrame into another. However, they only get executed once an action is called on a DataFrame.
In this recipe, we will provide an overview of the most popular actions.
Getting ready
To execute this recipe, you need to have a working Spark 2.3 environment. You should have gone through the previous recipe, Specifying schema programmatically, as we will be using the sample_data_schema
DataFrame we created there.
There are no other requirements.
How to do it...
In this section, we will list some of the most common actions available for DataFrames. The purpose of this list is not to provide a comprehensive enumeration of all available transformations, but to give you some intuition behind the most common ones.
The .show(...) action
The .show(...)
action, by default, shows the top five rows in tabular form. You can specify how many records to retrieve by passing an integer as a parameter.
Look at the following code...