"What fraction of its category does this product represent" needs a group total put back beside every original row. transform is the tool for that, and not knowing it exists is why people write merges they do not need.
Write category_share(df).
df has columns product, category and revenue, one row per product. Return a new DataFrame with the original columns plus a share column: that product's revenue divided by the total revenue of its category.
You have read the opening. The rest is free with a Bezen account, and no card is needed.
Behind the sign-in