Last active
June 1, 2016 10:41
-
-
Save kurozumi/4642d8a70440c57a2719c0e5c02013c5 to your computer and use it in GitHub Desktop.
【Python】CSVファイルのダミーデータを作成する方法
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
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