The data
776,577 real order lines from 5,852 customers
Every order placed with a UK-based online retailer of gifts and homeware between December 2009 and December 2011: 36,594 orders, £17.1M in sales, customers in 41 countries. Many customers are wholesalers buying for their own shops, so the data is closer to a business customer base than a typical web shop.
What each order line contains
- Invoice: the order number; a leading C marks a cancellation.
- StockCode and Description: the product.
- Quantity and Price: units and unit price in pounds sterling.
- InvoiceDate: date and time of the order.
- Customer ID and Country: who ordered, and where they are.
There are no customer attributes such as size or industry, so segments have to come from buying behaviour alone.
What cleaning removed
1,067,371 rows delivered, 776,577 kept. Each rule runs in SQL and logs what it removed:
- · Exact duplicates: 34,335 (counted twice otherwise)
- · No customer id: 235,151 (can't be attributed to a customer)
- · Not a product: 3,662 (postage, fees, discounts and manual lines aren't purchases)
- · Cancellations: 17,586 (kept separately for the return rate, not counted as sales)
- · Zero or negative quantity or price: 60 (stock adjustments and write-offs)
| Invoice | StockCode | Description | Quantity | InvoiceDate | Price | Customer ID |
|---|---|---|---|---|---|---|
| 534456 | 20713 | JUMBO BAG OWLS | 100 | 2010-11-23 | £1.65 | 14282 |
| 534456 | 21928 | JUMBO BAG SCANDINAVIAN PAISLEY | 20 | 2010-11-23 | £1.95 | 14282 |
| 534456 | 21929 | JUMBO BAG PINK VINTAGE PAISLEY | 20 | 2010-11-23 | £1.95 | 14282 |
| 534456 | 85099B | JUMBO BAG RED RETROSPOT | 100 | 2010-11-23 | £1.65 | 14282 |
| 534202 | 20719 | WOODLAND CHARLOTTE BAG | 20 | 2010-11-21 | £0.85 | 14282 |
| 534202 | 20723 | STRAWBERRY CHARLOTTE BAG | 20 | 2010-11-21 | £0.85 | 14282 |
The latest lines from customer 14282 (United Kingdom), as delivered. Country is the eighth column. Prices are in pounds sterling; the time of day is dropped here.