How do we find the lowest and highest product unit prices in a catalog in a single query?
min() and max() identify the minimum and maximum values in a Column across distributed partitions.
Detecting pricing boundaries, identifying latency spikes, and tracking date ranges in event logs.
from pyspark.sql.functions import col, max, min
df.select(
min(col("unit_price")).alias("min_price"),
max(col("unit_price")).alias("max_price")
).show()Practice typing production-grade PySpark code for Finding Range Extremes with min() and max().