July 2017
Intermediate to advanced
796 pages
18h 55m
English
The minimum of the column value of one of the columns in the DataFrame. An example is if you want to find the minimum temperature of a city.
The min API has several implementations, as follows. The exact API used depends on the specific use case:
def min(columnName: String): ColumnAggregate function: returns the minimum value of the column in a group.def min(e: Column): ColumnAggregate function: returns the minimum value of the expression in a group.
Let's look at an example of invoking min on the DataFrame to print the minimum Population:
import org.apache.spark.sql.functions._scala> statesPopulationDF.select(min("Population")).show+---------------+|min(Population)|+---------------+| 564513|+---------------+
Read now
Unlock full access