All projects
COMP2271 Data Science · Durham University

Laptop market data cleaning & recommendations

Dec 2023Data sciencePythonpandasseabornData cleaningEDA

Cleaned a messy scrape of 4,445 Amazon laptop listings down to 2,294 analysis-ready rows, then used the clean data to recommend five laptops under $1,500 for each of two customer profiles.

The brief

COMP2271 Data Science (2023–24) gave us a real dataset of laptops scraped from Amazon.com. The task had two parts: clean it into a usable state, then recommend five laptops under $1,500 for each of two client personas. Analysis had to use only pandas and seaborn, with the reasoning written up in a 750-word report.

4,445
Raw listings (14 columns)
2,294
Rows after cleaning (13 columns)
10
Laptops recommended across two client profiles

Source: amazon_laptop_2023.xlsx and amazon_laptop_2023_cleaned.xlsx

Cleaning the data

The raw export mixed units, text and numbers in the same columns and had many gaps. I wrote a reproducible cleaning pipeline:

  • Parsed screen size, RAM and storage into numbers, converting terabytes to gigabytes.
  • Normalised brand names and stripped "$" and thousands separators from prices.
  • Removed exact duplicates and rows missing the model, price, screen size, RAM or storage.
  • Filled missing ratings with the column mean, and missing descriptive fields (colour, CPU, operating system, graphics) with an explicit "None".
  • Dropped the sparsely populated CPU-speed column.

Cleaning pipeline

  1. 01
    Raw scrape
    4,445 listings with mixed units and gaps
  2. 02
    Standardise
    Numeric sizes, RAM, storage and prices; consistent brand names
  3. 03
    De-duplicate & drop
    Duplicates and rows missing key specs removed
  4. 04
    Impute
    Mean rating; explicit "None" for missing descriptions
  5. 05
    Clean dataset
    2,294 rows ready for analysis

Recommending laptops

Client 1, a gamer: at most $1,500, at least 16 GB of RAM and 1 TB of storage, Windows, and dedicated graphics, ranked by customer rating. The shortlist: Acer Nitro 5, two configurations of the Dell G15 5525, Asus Vivobook Pro 15 and Asus ROG Strix G15.

Bar chart of laptops priced at or below 1500 dollars by brand; Dell dominates
Laptops at or below $1,500 by brand, before the gaming filters. Dell dominates the listings. Chart from my coursework (seaborn).
Bar chart of laptops by brand after applying the gaming requirements
The same view after applying the gamer's requirements (RAM, storage, Windows, dedicated graphics).

Client 2, a travelling manager who prefers Dell: at most $1,500, a Dell, a screen of at least 15 inches, at least 8 GB of RAM and integrated graphics. The result was five 15.6-inch Dells (Latitude 3000, Inspiron 3511, Latitude 5540, Vostro and Precision 5560), all between $784 and $798.

Bar chart of Dell laptops under 1500 dollars by screen size; 15.6 inch is most common
Dell laptops under $1,500 by screen size: 15.6 inches is by far the most common, which shaped the second recommendation.
← Back to all projects