Skip to content

The Data Scientist

Data Science Portfolio

Data Science Portfolio Guide: Scraping, Cleaning, and Modeling Ecommerce Data

Hiring managers have seen the Titanic dataset more times than they can count. The same goes for Iris, MNIST, and the housing prices competition. These datasets are great for learning, but they say little about whether you can do the actual job. That job usually means working with data nobody has cleaned for you.

A portfolio project built on real-world data shows the skills that matter most: framing a business question, collecting your own data, fixing messy records, choosing an appropriate model, and explaining what the results mean. Ecommerce data is one of the best places to practice all of these. It is public, plentiful, and messy in exactly the ways production data is messy.

This walkthrough takes you through one complete project: estimating how price affects demand for products on a large marketplace. You can adapt every step to your own question.

Step 1: Start with a question, then collect the data

The most common portfolio mistake is starting with a dataset and hunting for something to do with it. Start with a question a business would actually pay to answer. For ecommerce, good options include:

  • Price elasticity: How much do sales drop when price rises, and does that differ by category?
  • Product trends: Which product types are growing fastest, and can we spot them early?
  • Listing quality: Do ratings, image count or title length predict sales?
  • Shipping trade-offs: How much more will buyers pay for faster delivery?

This guide uses price elasticity. It is a classic economics problem, it requires real modeling, and the answer is directly useful to sellers.

Collecting the data

AliExpress works well for this project. It lists millions of products, many sellers offer near-identical items at different prices, and each listing shows the number of orders. That combination gives you natural variation in price against a demand proxy.

Scraping a large marketplace by hand quickly runs into JavaScript-rendered pages, pagination, rate limits and blocking. For a portfolio project, using a dedicated AliExpress scraper is the practical choice. It returns structured results, so your time goes into analysis rather than maintaining a fragile crawler.

For each product, collect at least:

Field Why you need it
Product ID and title Identifying and grouping similar items
Category Comparing elasticity across product types
Price (and original price, if discounted) The main explanatory variable
Orders sold Your demand proxy
Rating and review count Controls for product quality
Shipping cost and delivery time Controls for total cost to the buyer
Seller rating Controls for trust
Collection date Lets you build a time series over repeated scrapes

Aim for a few thousand products across five to ten categories. If you can, repeat the collection weekly for a month or two. Panel data, where you see the same products at different prices over time, makes for a much stronger elasticity estimate than a single snapshot.

A note on responsible collection: only gather publicly visible product data, avoid any personal information about buyers or sellers, and respect the platform’s terms. Say how you collected the data in your write-up. Reviewers notice when candidates think about this.

Step 2: Clean the data (and document every decision)

This is where real-world projects separate themselves from tutorials. Marketplace data has predictable problems:

  • Prices as text, such as “US 12.99″orpricerangeslike”4.50 – $9.80″ for listings with variants.
  • Order counts as text, such as “1,000+ sold” or “5K+ sold”, which are rounded and capped.
  • Duplicates, because the same product appears in several searches or scrapes.
  • Outliers, such as $0.01 listings used as bait and accessories miscategorized next to main products.
  • Missing values, especially ratings for new listings.

A compact pandas cleaning step might look like this:

 

import numpy as np

import pandas as pd

 

df = pd.read_json(“aliexpress_products.json”)

 

# Parse prices; use the lower bound of a range

df[“price”] = (df[“price_text”]

    .str.replace(r“[^0-9.\-]“, “”, regex=True)

    .str.split(“–“).str[0]

    .astype(float))

 

# Parse order counts like “5K+ sold” or “1,000+ sold”

def parse_orders(s):

    s = str(s).lower().replace(“,”, “”).replace(“sold”, “”).replace(“+”, “”).strip()

    mult = 1000 if s.endswith(“k”) else 1

    s = s.rstrip(“k”)

    try:

        return float(s) * mult

    except ValueError:

        return np.nan

 

df[“orders”] = df[“orders_text”].apply(parse_orders)

 

# Deduplicate per product per scrape date

df = df.drop_duplicates(subset=[“product_id”, “collected_at”])

 

# Remove bait prices and extreme outliers within each category

df = df[df[“price”] > 0.5]

q_low = df.groupby(“category”)[“price”].transform(lambda x: x.quantile(0.01))

q_high = df.groupby(“category”)[“price”].transform(lambda x: x.quantile(0.99))

df = df[(df[“price”] >= q_low) & (df[“price”] <= q_high)]

 

# Total cost to the buyer

df[“total_cost”] = df[“price”] + df[“shipping_cost”].fillna(0)

Keep a short cleaning log in your README: what you removed, how many rows, and why. A line like “Dropped 412 listings priced under $0.50 as likely bait listings” shows judgment, which is exactly what reviewers look for.

Also be honest about the limits of your data. Rounded order counts such as “1,000+” are censored values, not exact sales. Say so, and consider treating them as ordered bands or using models that handle censoring.

Step 3: Explore, then model

Exploratory analysis

Before any modeling, plot the basics. Look at price distributions by category, then orders against price on log scales, then ratings against orders. Ecommerce data is usually heavily skewed: a few products take most of the orders. Log transforms will make the relationships much easier to see.

A few questions worth answering in your EDA:

  • Does the price-demand relationship look roughly linear on a log-log plot?
  • Do highly rated products sell more at the same price?
  • Do free-shipping listings outsell paid-shipping ones at the same total cost?

Estimating price elasticity

The standard starting point is a log-log regression, where the coefficient on log price is the elasticity estimate:

 

\log(\text{orders}) = \beta_0 + \beta_1 \log(\text{total cost}) + \beta_2 \,\text{rating} + \beta_3 \log(\text{reviews}+1) + \text{category effects} + \varepsilon

A β1 of −1.5, for example, would mean a 1% price increase is associated with roughly a 1.5% drop in orders.

 

import statsmodels.formula.api as smf

 

model_df = df.dropna(subset=[“orders”, “rating”]).copy()

model_df[“log_orders”] = np.log(model_df[“orders”] + 1)

model_df[“log_cost”] = np.log(model_df[“total_cost”])

model_df[“log_reviews”] = np.log(model_df[“review_count”] + 1)

 

model = smf.ols(

    “log_orders ~ log_cost + rating + log_reviews + C(category)”,

    data=model_df

).fit(cov_type=“HC3”)

 

print(model.summary())

Going further

This is where a good project becomes a strong one:

  • Elasticity by category. Interact log price with category to see which product types are most price-sensitive.
  • Address endogeneity. Popular products may be priced higher because they are popular, which biases the estimate. If you collected repeated scrapes, a product fixed-effects model uses only within-product price changes and handles much of this.
  • Compare against machine learning. Fit a gradient-boosted model to predict orders, then use partial dependence plots to compare its price effect with your regression. Discuss where they agree and where they don’t.
  • Validate properly. Use a time-based split if you have panel data, so you don’t leak future information into training.

Step 4: Present it like a professional

A strong analysis with weak presentation gets skimmed and forgotten. Package the project so a busy reviewer understands it in two minutes:

  1. Lead with the answer. The first lines of your README should state the finding, such as “Electronics accessories are roughly twice as price-sensitive as home decor.”
  2. Show one or two key charts, not twenty. A log-log scatter with the fitted line, and a bar chart of elasticity by category, usually carry the story.
  3. Explain the business implication. What should a seller do with this? Where could they raise prices with little loss in volume?
  4. List limitations honestly: censored order counts, possible confounders, and a single marketplace.
  5. Make it reproducible. Include a requirements file, clean notebooks or scripts, and a sample of the data if the terms allow it.
  6. Write a short blog post or LinkedIn summary linking to the repo. Many reviewers will read that before they open any code.

A side note for students: portfolios open doors before your first job

Portfolio projects aren’t only for job seekers. Competition for places in top data science, statistics and computer science programs has grown sharply, and admissions officers increasingly look for evidence of genuine interest beyond grades and test scores.

A high school or transfer student who has independently collected a dataset, cleaned it, and written up a thoughtful analysis has something concrete to talk about in essays and interviews. It shows curiosity, persistence and the ability to finish a project, which are qualities that are hard to show through coursework alone.

The key is framing. A project like this one is most persuasive when it connects to a bigger story about why you want to study data, not when it is listed as another activity. Students who aren’t sure how to position this kind of work often get help from college admissions consultants, who can help turn technical projects into a clear and compelling application narrative.

Conclusion

The best portfolio projects look like real work: a clear question, data you collected yourself, cleaning decisions you can defend, a model that fits the problem, and a write-up that tells someone what to do next. Ecommerce data gives you all of that in one project.

Start small. Pick one question, collect a few thousand products, and get to a first answer. Then improve it with repeated collection, better controls and a comparison against machine learning. One finished, well-explained project will do more for you than five half-done notebooks built on the same datasets everyone else uses.

Published Book (Springer Nature) • amazon.com

The Decision Maker's Handbook to Data Science

The definitive guide for non-technical executives and entrepreneurs on navigating AI, machine learning, and big data.