forked from TanyaradzwaGozhora/unify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fakedata.py
46 lines (32 loc) · 1.1 KB
/
fakedata.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from faker import Faker
import pandas as pd
import random
fake = Faker()
import json
def create_rows():
output = [{
"courses": courses(),
"googleId": googleId(),
"_v": 0,
"discordName": fake.name().split(' ', 1)[0] + "#" + str(random.randint(1000,9999)),
"preferredName":fake.name().split(' ', 1)[0]} for x in range(100)]
return output
def courses():
df = pd.read_excel('Courses.xlsx')
df.drop_duplicates(inplace=True)
course_list = []
random_courses = df.sample(n=3)
arr = random_courses.to_numpy()
for i in range(3):
course_list.append(str(arr[i][0]) + str(arr[i][1]))
return course_list
def googleId():
number = "1"
number += str(random.randint(100000,500000))
number += str(random.randint(100000,500000))
number += str(random.randint(100000,500000))
number += str(random.randint(100000,500000))
return number
dict = create_rows()
with open("sample.json", "w") as outfile:
json.dump(dict, outfile)