The file datasets/parquet/products.parquet holds one row per product in the
columnar Parquet format. What does every category look like?
paths['products'].category and collect the number of products and the average
price (rounded to two decimals).product_count descending, then by category ascending.category, product_count, avg_price.File questions receive the path as a third argument:
from pyspark.sql import functions as F
def solve(spark, dfs, paths):
products = spark.read.parquet(paths['products'])
# TODO: aggregate and sort
return products
The same data is also preloaded as dfs['products'] if you prefer to skip the file read.
This question runs in your browser - no sign-in needed. Press Run for the sample data and Submit for the hidden data.
These files are loaded into this browser when you run. Their paths are handed to your code as the third argument: solve(spark, dfs, paths). Read one with spark.read.csv(paths['users'], header=True), or skip the read and use dfs['users'].
products]Column names and order must match. Sort order is specified in the question.