How do we compute the average product review rating for each merchandise category?
Grouping by product category and applying the avg() aggregate function to rating scores.
Product catalog benchmarking, merchant quality monitoring, and recommendation engine features.
from pyspark.sql.functions import avg, col
df.groupBy("category").agg(avg(col("rating")).alias("avg_rating")).show()Practice typing production-grade PySpark code for Category Benchmarks with avg().