Which products receive mostly high review scores, and which receive a mix? A distribution shows how often each score occurs. Here, it is an observed pattern of counts, not a fitted probability model or a single satisfaction number. section 3.3.3
To compare categories and sellers, bring review scores, orders, order items, products, and category names together. Then count records for each category–seller–score combination. If an AI assistant suggests the workflow, first check that it has the DataFrame structure right. section 3.3.3
# Merge the DataFramesmerged_data = ( df_orders.merge(df_order_items, on='order_id') .merge(df_products, on='product_id') .merge(df_order_reviews, on='order_id') .merge(df_product_category_translation, on='product_category_name') )# Group by product_category_name_english, seller_id, and review_scorereview_score_distribution = merged_data.groupby(['product_category_name_english', 'seller_id', 'review_score']).size().reset_index(name='count')
The pandas listing shows the joins and groupby operation that produce score counts by category and seller. section 3.3.3
A grouped bar chart makes category-level counts easier to inspect. If too many score bars or product categories obscure the pattern, scores can be grouped as positive (4–5) or negative (below 4), and product categories can be combined into broader groups. Check that these choices preserve the distinction needed for the business question. section 3.3.3
Listing 3.1 Generating a grouped bar plot
import seaborn as sns
import matplotlib.pyplot as plt
def categorize_review_score(score):
if score >= 4:
return 'Positive'
else:
return 'Negative'
review_score_distribution['review_category'] =
review_score_distribution['review_score'].apply(categorize_review_score)
# Set a larger figure size
plt.figure(figsize=(20, 10))
# Create the grouped bar chart
sns.barplot(data=review_score_distribution,
x='product_category_name_english',
y='count',
hue='review_category',
ci=None)
# Rotate the x-axis labels for better readability
plt.xticks(rotation=90)
# Set labels for the axes and the title
plt.xlabel('Product Categories')
plt.ylabel('Review Count')
plt.title('Simplified Review Score Distribution by Product Category')
# Show the plot
plt.show()
The listing turns individual scores into positive and negative labels for a simpler grouped bar chart. section 3.3.3
The same idea offers a quick check on keyword-extracted positive reviews: plot their scores from 1 to 5 and look for a concentration at 4 or 5. Do not treat that pattern as proof. Positive reviews may lack the chosen keywords, and a negative review may contain one; sensitivity and specificity provide another way to assess the extraction. section 5.5.7


























