Last active
December 29, 2017 04:42
-
-
Save zkan/114b8dd80c9d0d7313a970284f60ca4a to your computer and use it in GitHub Desktop.
Try Faker - https://github.com/joke2k/faker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from faker import Faker | |
fake = Faker() | |
with open('transactions.csv', 'r') as file_: | |
with open('anonymized_transactions.csv', 'w') as new_file: | |
reader = csv.DictReader(file_) | |
writer = csv.DictWriter(new_file, fieldnames=reader.fieldnames) | |
writer.writeheader() | |
for row in reader: | |
row['name'] = fake.name() | |
row['email'] = fake.email() | |
row['credit_card_number'] = fake.credit_card_number() | |
writer.writerow(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment