-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData Generation
More file actions
39 lines (33 loc) · 1.1 KB
/
Copy pathData Generation
File metadata and controls
39 lines (33 loc) · 1.1 KB
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
import csv
import random
from faker import Faker
fake = Faker()
departments = ["Engineering", "Marketing", "Sales", "HR", "Finance", "IT", "Support", "Legal"]
salary_ranges = {
"Engineering": (60000, 120000),
"Marketing": (50000, 100000),
"Sales": (45000, 90000),
"HR": (50000, 95000),
"Finance": (55000, 110000),
"IT": (60000, 115000),
"Support": (40000, 80000),
"Legal": (65000, 125000)
}
employee_id = 1
for file_index in range(1, 17):
filename = f"employees_{file_index}.csv"
with open(filename, mode='w', newline='') as file:
writer = csv.writer(file)
writer.writerow(["EmployeeID", "LastName", "FirstName", "Department", "Salary"])
for _ in range(1000):
dept = random.choice(departments)
salary = round(random.uniform(*salary_ranges[dept]), 2)
writer.writerow([
employee_id,
fake.last_name(),
fake.first_name(),
dept,
salary
])
employee_id += 1
print("✅ Done! Check the notebook folder for 16 CSV files.")