How do we compute the mean employee salary across the entire organization?
avg() computes the arithmetic mean of numeric column values across all rows.
Compensation benchmarking, average order value tracking, and performance metrics.
from pyspark.sql.functions import col, avg
df.select(avg(col("salary")).alias("mean_salary")).show()Practice typing production-grade PySpark code for Calculating Averages with avg().