All resources

Dataset Python

Sales Transactions Dataset

A small fictional sales file for learning Python basics, validation rules and a first standard-library batch job.

Type
Dataset
Level
Beginner
Updated

In short

Twenty fictional sales rows from three stores, with deliberate problems to find. Twelve rows are valid and eight break a validation rule.

Who it is for

  • Beginners following the Python lessons of the Become a Data Engineer roadmap
  • Anyone who wants a tiny, predictable file to practice validation logic

What it helps you do

  • Read a CSV file with Python and inspect its rows
  • Apply required-field and numeric validation rules
  • Check your results against known counts and totals

Dataset shape

The file sales_transactions.csv has a header row and 20 data rows. All stores, products and transactions are fictional, and the file contains no personal information.

Column Meaning
transaction_id Identifier such as T1001. One row has a blank value
order_date ISO date (YYYY-MM-DD) between 2026-03-02 and 2026-03-08
store Lisbon, Porto or Faro
product Notebook, Desk Lamp, Backpack or Water Bottle. One row has a blank value
quantity Units sold. Includes a zero, a negative number and the text two
unit_price Price per unit with a dot as decimal separator. Includes a blank, a comma decimal (24,90) and a negative price

Deliberate problems

Eight rows break one rule each, so every rule has an example to find:

Row Problem
T1005 quantity is 0
T1007 product is blank
T1008 quantity is -1
T1009 quantity is the text two
T1011 unit_price is blank
T1012 unit_price uses a decimal comma: 24,90
(blank id) transaction_id is blank
T1018 unit_price is -24.90

Known results

Use these numbers to check your own code. With the rules “every field is present, quantity is a whole number greater than zero, unit price is a number greater than zero”:

  • rows read: 20
  • valid rows: 12
  • rejected rows: 8
  • units sold in valid rows: 43
  • total revenue of valid rows (quantity × unit price): 479.70

The first eight rows alone, used in Python Essentials Part 1, contain five valid sales worth 188.70.

How the lessons use it

Set Up Python for Data Engineering asks you to save the file in a data folder and confirms Python can find it. Python Essentials Part 1 copies the first eight rows into a Python list to practice loops and conditions. Python Essentials Part 2 reads the whole file with the csv module, validates every row and writes the valid and rejected rows to separate files.