Usage¶
Business¶
The business module allows you to create fake business data. Calling business.create_business() will return a dictionary of related tables.
import pandas as pd
from pydatafaker import business
biz = business.create_business()
biz.keys()
dict_keys(['vendor_table', 'po_table', 'invoice_summary_table', 'invoice_line_item_table', 'employee_table', 'contract_table', 'rate_sheet_table', 'timesheet_table'])
Each value inside the dictionary contains a Pandas DataFrame.
biz["vendor_table"]
biz["employee_table"]
biz["po_table"]
biz["invoice_summary_table"]
biz["invoice_line_item_table"]
| invoice_id | invoice_line_id | amount | description | |
|---|---|---|---|---|
| 0 | inv_00001 | line_item_000000001 | 4404 | 0-7299-7353-0 |
| 1 | inv_00001 | line_item_000002781 | 1233 | 0-8184-1802-8 |
| 2 | inv_00001 | line_item_000004837 | 5056 | 1-4642-5447-8 |
| 3 | inv_00001 | line_item_000004797 | 5253 | 1-175-64411-0 |
| 4 | inv_00001 | line_item_000000947 | 1792 | 1-956222-62-6 |
| ... | ... | ... | ... | ... |
| 5445 | inv_00450 | line_item_000000707 | 4198 | 0-603-62234-8 |
| 5446 | inv_00450 | line_item_000003163 | 4131 | 1-06-101759-1 |
| 5447 | inv_00450 | line_item_000003874 | 5193 | 0-482-36167-0 |
| 5448 | inv_00450 | line_item_000005441 | 4189 | 1-03-258645-1 |
| 5449 | inv_00450 | line_item_000000915 | 3398 | 0-03-148841-2 |
5450 rows × 4 columns
Tables can be joined together to add additional details.
invoice_summary = biz['invoice_summary_table']
vendors = biz['vendor_table']
pd.merge(invoice_summary, vendors, how='left', on='vendor_id')
| invoice_id | amount | invoice_date | po_id | vendor_id | vendor_name | vendor_description | address | phone | ||
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | inv_00001 | 50384 | 2014-01-22 | po_00001 | vendor_00001 | Duran LLC | Multi-lateral bottom-line attitude | 756 Emma Loop\nNew Randallton, MA 34074 | 001-403-947-8923x710 | lreed@example.net |
| 1 | inv_00002 | 41242 | 2001-08-07 | po_00002 | vendor_00002 | Mcconnell, Cook and Jacobs | Multi-channeled 4thgeneration access | 3908 Moore Ferry Suite 731\nRileystad, OH 66846 | 7967687131 | hscott@example.org |
| 2 | inv_00003 | 93168 | 2018-08-03 | po_00003 | vendor_00003 | Fowler PLC | De-engineered analyzing matrix | 3744 Sarah Islands Apt. 917\nThompsonhaven, AK... | 881.131.6277x81348 | brandon73@example.com |
| 3 | inv_00004 | 62921 | 2003-07-08 | po_00004 | vendor_00004 | Washington, Jimenez and Melendez | Horizontal 24/7 flexibility | 872 Ware Terrace\nLake Sarafort, NY 25369 | 964.601.5818 | sramirez@example.org |
| 4 | inv_00005 | 72479 | 2000-10-01 | po_00005 | vendor_00005 | Johnson-Martinez | Upgradable modular middleware | 2928 Dalton Station Apt. 170\nNorth Theresahav... | (100)611-9164x12103 | danieljeanette@example.org |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 445 | inv_00446 | 63753 | 2014-08-19 | po_00059 | vendor_00059 | Romero, Miller and Cruz | Configurable optimizing instruction set | 5751 Brian Green\nSouth Nicoleside, OR 95098 | 751.189.4118x40072 | lbrewer@example.org |
| 446 | inv_00447 | 114723 | 2018-06-03 | po_00032 | vendor_00032 | Hill LLC | Stand-alone regional intranet | 1052 Benjamin Spurs\nPort Carl, FL 75681 | (460)310-2789x04620 | michelle35@example.net |
| 447 | inv_00448 | 45416 | 2016-03-05 | po_00134 | vendor_00047 | Harris-Lyons | Virtual value-added archive | 751 Paul Square\nNorth Raymondview, AL 26626 | +1-211-463-2487x4474 | terri31@example.net |
| 448 | inv_00449 | 58418 | 2018-09-27 | po_00052 | vendor_00052 | Thompson-Young | Secured 3rdgeneration archive | 957 Sharon Lakes Suite 644\nSouth Victoriaside... | 0474775509 | edward24@example.net |
| 449 | inv_00450 | 59770 | 2018-08-31 | po_00101 | vendor_00041 | Wood, Mason and Lopez | Visionary explicit software | 73688 Daugherty Coves\nPort Pamela, UT 76207 | 574.997.1700 | stevenlowery@example.com |
450 rows × 10 columns
School¶
The school module allows you to generate fake school data
import pandas as pd
from pydatafaker import school
skool = school.create_school()
skool.keys()
skool['student_table']
skool['teacher_table']
skool['room_table']
skool['grade_table']
| student_id | test_score | date | |
|---|---|---|---|
| 0 | student_0009 | 0.824952 | 2020-12-27 |
| 1 | student_0009 | 0.651192 | 2021-02-15 |
| 2 | student_0009 | 0.884640 | 2021-01-25 |
| 3 | student_0009 | 0.862511 | 2021-04-03 |
| 4 | student_0009 | 1.000000 | 2021-01-18 |
| ... | ... | ... | ... |
| 2995 | student_0300 | 0.762023 | 2021-06-02 |
| 2996 | student_0300 | 0.820461 | 2020-12-10 |
| 2997 | student_0300 | 0.703434 | 2021-07-25 |
| 2998 | student_0300 | 0.714107 | 2021-04-14 |
| 2999 | student_0300 | 0.832456 | 2020-10-30 |
3000 rows × 3 columns