Skip to content

Instantly share code, notes, and snippets.

@kurozumi

kurozumi/dummy_data.py

Last active Jun 1, 2016
Embed
What would you like to do?
【Python】CSVファイルのダミーデータを作成する方法
from faker import Factory
import csv
with open("dummy_data.csv", "w") as f:
writer = csv.writer(f)
fake = Factory.create()
for i in range(100):
# 数字と文字列と日時をランダムで生成
row = [fake.random_int(), fake.word(), fake.date_time()]
writer.writerow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment