runtime

datasets real and made-up data to practise on

Datasets

Data for the Playground, Database Lab and Performance Lab. Pick one and open its files.

Real invoice lines from a UK online gift wholesaler, 2009–2011, cancellations and all.

1,875 invoice lines3 tablesDec 2009 – Dec 2011

what to watch for

Tricky rows

  • Cancellation lines: Invoice starts with C and Quantity is negative11 rows
  • Lines with no Customer ID (walk-in or unregistered buyers)819 rows
  • Lines identical to an earlier line in every column30 rows
  • Lines with Price 0 (adjustments, samples, damaged stock)11 rows

files

Open a file to see what one row means, its columns and a preview. Open in Playground starts a new file there with code that loads it.

invoice_lines1,875 rows · 8 columns · CSV

One line of an invoice, as the wholesaler’s system recorded it. Not unique: the same line can appear twice.

In your code: data/invoice_lines.csv

  • Invoicetext

    Invoice number; a leading C marks a cancellation

  • StockCodetext→ products

    Product code; some codes are fees or adjustments, not products

  • Descriptiontext · can be empty

    Line description as typed on the invoice

  • Quantityinteger

    Units; negative on cancellations

  • InvoiceDatetimestamp

    Invoice date and time (UK local time)

  • Pricedecimal

    Unit price in pounds sterling

  • Customer IDinteger · can be empty→ customers

    Customer number; empty for anonymous invoices

  • Countrytext

    Customer country

products1,042 rows · 4 columns · CSV

One stock code, with the description and price it most often had.

In your code: data/products.csv

  • stock_codetextkey

    Stock code

  • descriptiontext · can be empty

    Most common description

  • list_pricedecimal · can be empty

    Most common unit price; empty when never sold at a price

  • first_sold_attimestamp · can be empty

    First invoice with this code

customers56 rows · 3 columns · CSV

One registered customer who appears in these invoices.

In your code: data/customers.csv

  • customer_idintegerkey

    Customer number

  • countrytext

    Country

  • first_order_attimestamp

    First invoice

relationships

How to join these tables. Left column matches the right column.

  • invoice_lines.StockCode → products.stock_code
  • invoice_lines.Customer ID → customers.customer_id

where the course uses it

Lessons and practice questions use small samples of Online Retail; projects open its files.

Online Retail dataset — Python Datasets · Runtime