-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecordmaker.py
More file actions
86 lines (66 loc) · 2.88 KB
/
recordmaker.py
File metadata and controls
86 lines (66 loc) · 2.88 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import pandas as pd
import numpy as np
import random
# Number of records
n = 6000
# Sample list of first names & last names
first_names = ["Aarav", "Vihaan", "Jadwinder", "Arjun", "Amit", "Rohan", "Sahil", "Karan",
"Mandeep", "Gurpreet", "Simran", "Navjot", "Harsh", "Anjali", "Sneha",
"Ritika", "Pooja", "Neha", "Rahul", "Deepak"]
last_names = ["Singh", "Sharma", "Kumar", "Verma", "Gupta", "Kaur", "Yadav", "Chopra",
"Bansal", "Sodhi", "Grewal", "Dhillon", "Arora", "Saxena", "Mehta"]
genders = ["Male", "Female", "Other"]
# Function to generate random names
def random_name():
return random.choice(first_names) + " " + random.choice(last_names)
# Generate dataset
data = {
"Student_ID": range(1, n + 1),
"Name": [random_name() for _ in range(n)],
"Gender": [random.choice(genders) for _ in range(n)], # NEW FIELD
"Age": np.random.randint(18, 26, size=n), # NEW FIELD (18–25)
"Attendance(%)": np.random.randint(60, 101, size=n), # 60–100%
"Math": np.random.randint(20, 101, size=n),
"Science": np.random.randint(20, 101, size=n),
"English": np.random.randint(20, 101, size=n),
"History": np.random.randint(20, 101, size=n),
"Computer": np.random.randint(20, 101, size=n),
}
df = pd.DataFrame(data)
# Save as CSV file
file_path = "student_performance_6000.csv"
df.to_csv(file_path, index=False)
print("CSV file generated successfully:", file_path)
import pandas as pd
import numpy as np
import random
# Number of records
n = 6000
# Sample list of first names & last names
first_names = ["Aarav", "Vihaan", "Jadwinder", "Arjun", "Amit", "Rohan", "Sahil", "Karan",
"Mandeep", "Gurpreet", "Simran", "Navjot", "Harsh", "Anjali", "Sneha",
"Ritika", "Pooja", "Neha", "Rahul", "Deepak"]
last_names = ["Singh", "Sharma", "Kumar", "Verma", "Gupta", "Kaur", "Yadav", "Chopra",
"Bansal", "Sodhi", "Grewal", "Dhillon", "Arora", "Saxena", "Mehta"]
genders = ["Male", "Female", "Other"]
# Function to generate random names
def random_name():
return random.choice(first_names) + " " + random.choice(last_names)
# Generate dataset
data = {
"Student_ID": range(1, n + 1),
"Name": [random_name() for _ in range(n)],
"Gender": [random.choice(genders) for _ in range(n)], # NEW FIELD
"Age": np.random.randint(18, 26, size=n), # NEW FIELD (18–25)
"Attendance(%)": np.random.randint(60, 101, size=n), # 60–100%
"Math": np.random.randint(20, 101, size=n),
"Science": np.random.randint(20, 101, size=n),
"English": np.random.randint(20, 101, size=n),
"History": np.random.randint(20, 101, size=n),
"Computer": np.random.randint(20, 101, size=n),
}
df = pd.DataFrame(data)
# Save as CSV file
file_path = "student_performance_6000.csv"
df.to_csv(file_path, index=False)
print("CSV file generated successfully:", file_path)