liveBook · Manning

Review score

As explained in Starting Data Analytics with Generative AI and Python

A review score is a numerical rating assigned by a customer to express an evaluation of a product or purchase.

A review score is a customer’s numerical rating of a purchase experience. In the review dataset, `review_score` runs from 1 to 5 and accompanies a review identifier, order identifier, Portuguese-language comment fields, and survey timestamps. It offers a quick signal of customer satisfaction, but a single overall number can hide differences between products and sellers. section 5.2.2 section 3.3.3

A practical first question is: How are scores distributed across product categories and sellers? Ask an AI assistant for a workflow, giving it the actual DataFrame names and columns rather than trusting it to remember an earlier description. Then inspect and run the suggested code. section 3.3.3

# Merge the DataFrames
merged_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_score
review_score_distribution = 
merged_data.groupby(['product_category_name_english', 'seller_id', 
'review_score']).size().reset_index(name='count')

This pandas workflow joins orders, items, products, reviews, and category translations, then counts records for each category–seller–score combination. Check that the joins and resulting counts match the intended records before interpreting them. section 3.3.3

A grouped bar chart can display score counts by product category. With many categories and score levels, it may become difficult to read. A simpler view labels scores of 4 or 5 “Positive” and lower scores “Negative”; broader product groups can reduce clutter further. Those choices improve readability but discard detail, so retain the original scores for follow-up checks. If plotting from pre-counted rows, verify that the chart displays the intended totals after any regrouping. section 3.3.3

From description to explanation

Suppose one category appears to receive weaker ratings. Its score distribution identifies where to look; it does not establish why customers rated it that way. An ordinal logistic regression can examine associations between review score and delivery time, price, freight value, product attributes, and payment attributes. Interpret its coefficients cautiously: a reported example had approximately 43% accuracy, and its fit statistics raised concerns about how well it captured the relationships. Treat an AI-generated business explanation as a hypothesis to check against the model results and individual reviews, not as proof that changing an attribute will raise scores. section 4.7 section 5.2.2

How Starting Data Analytics with Generative AI and Python covers it

How deep it goes
Works through joins, grouped counts, and charts, then treats regression interpretation cautiously rather than establishing causal effects.
Examples
Shows category-level score charts, positive–negative score grouping, and a regression using delivery, product, transaction, and payment attributes.
What it assumes
Assumes access to review and order-related data while spelling out the rating field and the DataFrames needed for analysis.
What you can do after
Apply it via pandas and plotting tools to inspect rating distributions, then evaluate proposed explanations against model limitations.
How it connects
Connects review scores to descriptive analysis, data visualization, ordinal logistic regression, and customer feedback text.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Starting Data Analytics with Generative AI and Python. The section links point to the parts of the book it draws on.