pydatafaker.business.create_invoice_table¶
-
pydatafaker.business.create_invoice_table(po_table, mean_inv_line_amount=5000, sd_inv_line_amount=4000, min_date='2000-01-01', max_date='2020-12-31', n_invoice=250, n_line_item=5000)[source]¶ Create fake invoice and invoice line item tables.
- Parameters
po_table (pd.DataFrame) – The purchase order table created by create_po_table().
mean_inv_line_amount (int, optional) – The mean value of invoice line items, by default 5_000.
sd_inv_line_amount (int, optional) – The standard deviation of invoice line items, by default 4_000.
min_date (str, optional) – The minimum possible date, by default ‘2000-01-01’.
max_date (str, optional) – The maximum possible date, by default ‘2020-12-31’.
n_invoice (int, optional) – The number of invoices to generate in excess of 1 invoice for each PO. By default 250.
n_line_item (int, optional) – The number of invoice line items to generate in excess of 1 line item per invoice. By default 5_000.
- Returns
A tuple of two dataframes: invoice_summary and invoice_line_items.
- Return type
(pandas.DataFrame, pandas.DataFrame)
Examples
>>> from pydatafaker import business >>> po_table = business.create_po_table(['vendor_1', 'vendor_2'], n=3) >>> inv_summary, inv_line_item = business.create_invoice_table(po_table) >>> inv_summary invoice_id amount invoice_date po_id vendor_id 0 inv_00001 87829 2010-09-12 po_00001 vendor_1 1 inv_00002 111015 2006-11-08 po_00002 vendor_2 2 inv_00003 113403 2013-07-01 po_00003 vendor_1 3 inv_00004 100322 2000-01-04 po_00004 vendor_1 4 inv_00005 127148 2014-10-27 po_00005 vendor_2 .. ... ... ... ... ... 250 inv_00251 73123 2015-04-22 po_00004 vendor_1 251 inv_00252 108463 2000-10-20 po_00004 vendor_1 252 inv_00253 66640 2008-03-02 po_00003 vendor_1 253 inv_00254 134062 2019-09-02 po_00002 vendor_2 254 inv_00255 105510 2007-09-24 po_00002 vendor_2 [255 rows x 5 columns] >>> inv_line_item invoice_id invoice_line_id amount description 0 inv_00001 line_item_000000001 3122 0-7745-2454-5 1 inv_00001 line_item_000001972 7211 1-884097-46-4 2 inv_00001 line_item_000002279 5460 1-80940-801-6 3 inv_00001 line_item_000002367 10747 0-7425-2011-0 4 inv_00001 line_item_000002491 9836 1-303-76036-3 ... ... ... ... ... 5250 inv_00255 line_item_000005166 3916 0-8466-4508-4 5251 inv_00255 line_item_000001643 5948 1-334-08325-8 5252 inv_00255 line_item_000000734 6931 0-13-809752-6 5253 inv_00255 line_item_000003126 5303 1-57517-108-2 5254 inv_00255 line_item_000003778 2161 0-222-91897-7 [5255 rows x 4 columns]