Skip to content

Instantly share code, notes, and snippets.

@eddjberry
Last active December 10, 2021 11:25
Show Gist options
  • Save eddjberry/9b6f7c697a7ec2a442c2031b056b556c to your computer and use it in GitHub Desktop.
Save eddjberry/9b6f7c697a7ec2a442c2031b056b556c to your computer and use it in GitHub Desktop.
import pandas as pd
from faker import Faker
# set the seed
Faker.seed(10)
# set the locale to GB
fake = Faker("en_GB")
# how many customers to fake
N = 1000
# get first names, last names and postcodes
fname = [fake.first_name() for i in range(N)]
lname = [fake.last_name() for i in range(N)]
pcode = [fake.postcode() for i in range(N)]
# create a dataframe
df_fake = pd.DataFrame({
"fname": fname,
"lname": lname,
"pcode": pcode})
# save to a csv
df_fake.to_csv("data/fake_customers.csv", index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment