pydatafaker.school.create_school¶
-
pydatafaker.school.create_school(n_students=300, max_class_size=22, min_grade=1, max_grade=7, n_tests_per_student=10, min_date='2020-09-01', max_date='2021-07-30')[source]¶ Create an entire fake school.
A meta function that creates an entire fake school represented by different tables. The tables have relationships between theme. A dictionary is returned that contains the following DataFrames:
student_table
teacher_table
room_table
- Parameters
n_students (int, optional) – The number of students to generate, by default 300.
max_class_size (int, optional) – The maximum number of students that can be assigned to one teacher, by default 22.
min_grade (int, optional) – The minimum grade a teacher can teach, by default 1.
max_grade (int, optional) – The maximum grade a teacher can teach, by default 7.
n_tests_per_student (int, optional) – The number of tests to generate per student, by default 10.
min_date (str, optional) – The minimum possible date, by default ‘2020-09-01’.
max_date (str, optional) – The maximum possible date, by default ‘2021-07-30’.
- Returns
A dictionary containing related DataFrames.
- Return type
dict
Examples
>>> from pydatafaker import school >>> skool = school.create_school() >>> type(skool) <class 'dict'> >>> skool.keys() dict_keys(['student_table', 'teacher_table', 'room_table', 'grade_table']) >>> skool['student_table'] student_id name grade teacher_id 0 student_0002 Barry Nichols 1 teacher_0001 1 student_0005 Dr. Sheri Williams 1 teacher_0013 2 student_0006 Jason Park 1 teacher_0001 3 student_0014 Christopher Allen 1 teacher_0013 4 student_0021 Thomas Johnson 1 teacher_0001 .. ... ... ... ... 43 student_0280 Crystal Hughes 7 teacher_0015 44 student_0289 Rachel Barajas 7 teacher_0016 45 student_0292 Steven Brown 7 teacher_0002 46 student_0296 Cynthia Bright 7 teacher_0015 47 student_0297 Brian Hill 7 teacher_0016 [300 rows x 4 columns] >>> skool['teacher_table'] teacher_id name grade room_id 0 teacher_0001 Andrew Valencia 1 room_009 1 teacher_0002 Brenda Howell 7 room_005 2 teacher_0003 Drew Garcia 3 room_010 3 teacher_0004 Chad Byrd 5 room_013 4 teacher_0005 Alexander Williams 6 room_016 5 teacher_0006 Mrs. Angela Baird 4 room_015 6 teacher_0007 Megan Dillon 4 room_008 7 teacher_0008 Robert Murray 3 room_003 8 teacher_0009 Robin Wood 2 room_004 9 teacher_0010 Brent Castillo 2 room_001 10 teacher_0011 Tina Jones 4 room_006 11 teacher_0012 Evan Riddle 5 room_007 12 teacher_0013 Nancy Key 1 room_011 13 teacher_0014 Mary Thomas 2 room_014 14 teacher_0015 Troy Cole 7 room_002 15 teacher_0016 Michael Lowery 7 room_012 16 teacher_0017 Robert Hicks 6 room_017