Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active June 1, 2016 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/4642d8a70440c57a2719c0e5c02013c5 to your computer and use it in GitHub Desktop.
Save kurozumi/4642d8a70440c57a2719c0e5c02013c5 to your computer and use it in GitHub Desktop.
【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