learning-it by example

Back to the video

Fake but Realistic Test Data in Python With Faker

A quick comma-split loader failed on all 200 rows of realistic fake customers.

Video #100 ยท AI security and governance

Steps in the video

  1. 0:00 A comma-split loader failed on all two hundred realistic rows
  2. 0:33 The idea
  3. 1:10 Setup
  4. 1:32 Fake customers
  5. 1:58 Two loaders
  6. 2:17 Four checks
  7. 3:09 What this does not show
  8. 3:45 Mistakes to avoid
  9. 4:11 My take and next steps
  10. 4:42 Recap

Files

  • compare.py (20 lines)
  • loaders.py (22 lines)
  • people.py (14 lines)

Download the code (zip)

Tested with

Python 3.12.15 | Faker==40.41.0

What this does not show

200 made-up customers from one library (Faker 40.41.0), one locale (en_GB) and one seed; only four email calls tested; the date of birth depends on the day you run it; fake rows are not the shape of your real data.

Sources

Learning IT by Example.