From a0d7e425ba288d0a68b0551b8ee77f3b655610ef Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Mon, 22 May 2017 11:20:45 -0400 Subject: [PATCH 1/5] Create average_list_with_none() and its test files --- bpfin/lib/other.py | 17 +++++++++++++++++ bpfin/tests/test_lib/test_other.py | 18 ++++++++++++++++++ bpfin/tests/testdata/sample_data.py | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/bpfin/lib/other.py b/bpfin/lib/other.py index 7c080a7..0daf8f2 100644 --- a/bpfin/lib/other.py +++ b/bpfin/lib/other.py @@ -488,6 +488,23 @@ def month_shift(month): return month_shift_dict[month] +def average_list_with_none(list1): + """ + determine average value for all not-None elements in a list + Args: + list1 (list): list of float values + Return: + float: average value + """ + # if len(list1) == 0: + # return 0 + # else: + new_list = [] + for element in list1: + if element: + new_list.append(element) + return (sum(new_list)/len(new_list) if len(new_list) else 0) + ####inflation calculation #product inflation rate from starting date to target date diff --git a/bpfin/tests/test_lib/test_other.py b/bpfin/tests/test_lib/test_other.py index 0fdbb95..cc5f877 100644 --- a/bpfin/tests/test_lib/test_other.py +++ b/bpfin/tests/test_lib/test_other.py @@ -1,6 +1,7 @@ from bpfin.lib.other import add_year_dictionary from bpfin.lib.other import subtract_year_dictionary from bpfin.lib.other import divide_dscr_dict +from bpfin.lib.other import average_list_with_none from bpfin.tests.testdata import sample_data as db @@ -27,3 +28,20 @@ def test_divide_dscr_dict(): output = {2011: 0.0, 2012: 2.5, 2013: 0.3333333333333333, 2014: 2.0, 2015: None} result = divide_dscr_dict(year_1_input, year_2_input) assert result == output + + +def test_average_list_with_none(): + input_list = [] + output_list = [] + input_list.append([1, 2, 3]) + output_list.append(2.0) + input_list.append([1, 2, None]) + output_list.append(1.5) + input_list.append([1, None, None]) + output_list.append(1.0) + input_list.append([None, None, None]) + output_list.append(0) + input_list.append([1, None, 3]) + output_list.append(2.0) + for test_input, test_output in zip(input_list, output_list): + assert test_output == average_list_with_none(test_input) diff --git a/bpfin/tests/testdata/sample_data.py b/bpfin/tests/testdata/sample_data.py index 2fb3de6..34bab1b 100644 --- a/bpfin/tests/testdata/sample_data.py +++ b/bpfin/tests/testdata/sample_data.py @@ -2879,7 +2879,7 @@ raw_gas_bill_demo['date_from'] = [ datetime.date(2015, 12, 16), datetime.date(2015, 11, 16), datetime.date(2015, 10, 16), datetime.date(2015, 9, 19), datetime.date(2015, 8, 18), datetime.date(2015, 7, 20), datetime.date(2015, 6, 18), datetime.date(2015, 5, 19)] -raw__gas_bill_demo['date_to'] = [ +raw_gas_bill_demo['date_to'] = [ datetime.date(2016, 12, 16), datetime.date(2016, 11, 22), datetime.date(2016, 10, 18), datetime.date(2016, 9, 30), datetime.date(2016, 9, 19), datetime.date(2016, 8, 18), datetime.date(2016, 7, 20), datetime.date(2016, 6, 20), datetime.date(2016, 5, 18), -- GitLab From fc48690971bfcfe8a68d7691a9de4933acb88648 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Mon, 22 May 2017 19:11:17 -0400 Subject: [PATCH 2/5] Update func and test files for none_list average() --- bpfin/financials/financial_income.py | 1 + bpfin/lib/back_end_call.py | 25 +- bpfin/lib/data_generation.py | 379 ++++++++++++++++++ .../test_utilbills/test_back_end_call.py | 4 +- bpfin/tests/testdata/feature_data.py | 273 ++++++------- bpfin/utilbills/bill.py | 6 +- data_generation.py | 1 + 7 files changed, 541 insertions(+), 148 deletions(-) create mode 100644 data_generation.py diff --git a/bpfin/financials/financial_income.py b/bpfin/financials/financial_income.py index f13b4ea..10781b4 100644 --- a/bpfin/financials/financial_income.py +++ b/bpfin/financials/financial_income.py @@ -9,6 +9,7 @@ # from numpy import mean # # from bpfin.tests.testdata import sample_data as db # # import pprint +# from bpfin.lib.other import average_list_with_none # class Income_Statement(): diff --git a/bpfin/lib/back_end_call.py b/bpfin/lib/back_end_call.py index 0df33f3..6b70fbf 100644 --- a/bpfin/lib/back_end_call.py +++ b/bpfin/lib/back_end_call.py @@ -1,6 +1,6 @@ from bpfin.utilbills.bill import Bill from bpfin.financials.financial_lib import Income_Statement_Table -# from bpfin.tests.testdata import feature_data as db +from bpfin.tests.testdata import feature_data as db # import pprint @@ -122,7 +122,7 @@ def annual_bill(raw_bill_table, raw_annual_bill_table, analysis_date): return annual_bill_table -def prior_income_statement(raw_income_input, raw_bill_table, raw_annual_bill_table, analysis_date, growth_rate_flag): +def prior_income_statement_table(raw_income_input, raw_bill_table, raw_annual_bill_table, analysis_date, growth_rate_flag): """ Take in prior-annual_bill_table, and raw inputs of income statements Generate historical income statement, calculate its characters including CAGR and other percent ratios @@ -164,14 +164,21 @@ def prior_income_statement(raw_income_input, raw_bill_table, raw_annual_bill_tab # **** ugly test **** # print('\nmonthly_bill =', monthly_bill(db.raw_bill_table, db.analysis_date)) # print('\nannual_bill =', annual_bill(db.raw_bill_table, db.raw_annual_bill_table, db.analysis_date)) -# print('\nprior_income_statement =', prior_income_statement( +# print('\nprior_income_statement =', prior_income_statement_table( # db.raw_income_input, -# db.prior_annual_bill, +# db.raw_bill_table, +# db.raw_annual_bill_table, # db.analysis_date, # -2.0)) - -# writein = str(result) -# f = open('data_generation.py', 'w') -# f.write(writein) -# f.close() +result = prior_income_statement_table( + db.raw_income_input, + db.raw_bill_table, + db.raw_annual_bill_table, + db.analysis_date, + -2.0) + +writein = str(result) +f = open('data_generation.py', 'w') +f.write(writein) +f.close() diff --git a/bpfin/lib/data_generation.py b/bpfin/lib/data_generation.py index e69de29..0e889f6 100644 --- a/bpfin/lib/data_generation.py +++ b/bpfin/lib/data_generation.py @@ -0,0 +1,379 @@ +prior_income_statement_cagr = { + 2014: { + 'year': 2014, + 'revenue': 90000, + 'utility_expense': 55000, + 'energy_opex': 3842.7461677191232, + 'electricity_opex': 1346.0795010524571, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 51157.253832280876, + 'non_utility_expense': 3500, + 'net_non_energy_opex': 54657.253832280876, + 'total_opex': 58500.0, + 'noi': 31500.0 + }, + 2015: { + 'year': 2015, + 'revenue': 95000, + 'utility_expense': 55000, + 'energy_opex': 3387.4370596899435, + 'electricity_opex': 1357.4370596899435, + 'gas_opex': 1020, + 'oil_opex': 1010, + 'water_opex': 0, + 'other_utility': 51612.562940310054, + 'non_utility_expense': 3000, + 'net_non_energy_opex': 54612.562940310054, + 'total_opex': 58000.0, + 'noi': 37000.0 + }, + 2016: { + 'year': 2016, + 'revenue': 100000, + 'utility_expense': 60000, + 'energy_opex': 3798.4645719731475, + 'electricity_opex': 1368.4645719731475, + 'gas_opex': 1220, + 'oil_opex': 1210, + 'water_opex': 0, + 'other_utility': 56201.535428026851, + 'non_utility_expense': 3000, + 'net_non_energy_opex': 59201.535428026851, + 'total_opex': 63000.0, + 'noi': 37000.0 + }, + 2017: { + 'year': 2017, + 'revenue': 105409.25533894598, + 'utility_expense': 63221.916617675291, + 'energy_opex': 4425.2434398071118, + 'electricity_opex': 1395.2434398071116, + 'gas_opex': 1520, + 'oil_opex': 1510, + 'water_opex': 0, + 'other_utility': 58796.673177868179, + 'non_utility_expense': 3513.6418446315324, + 'net_non_energy_opex': 62310.315022499708, + 'total_opex': 66735.558462306813, + 'noi': 38673.696876639166 + }, + 2018: { + 'year': 2018, + 'revenue': 111111.11111111112, + 'utility_expense': 65903.741165893778, + 'energy_opex': 3926.6058050291458, + 'electricity_opex': 1429.9391383624793, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 61977.135360864631, + 'non_utility_expense': 3703.703703703704, + 'net_non_energy_opex': 65680.839064568339, + 'total_opex': 69607.444869597486, + 'noi': 41503.666241513638 + }, + 2019: { + 'year': 2019, + 'revenue': 117121.3948210511, + 'utility_expense': 69291.425515227427, + 'energy_opex': 3961.7886509294549, + 'electricity_opex': 1465.1219842627888, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 65329.63686429798, + 'non_utility_expense': 3904.0464940350366, + 'net_non_energy_opex': 69233.683358333015, + 'total_opex': 73195.472009262478, + 'noi': 43925.922811788623 + }, + 2020: { + 'year': 2020, + 'revenue': 123456.79012345681, + 'utility_expense': 72859.593377950107, + 'energy_opex': 3996.1096436560692, + 'electricity_opex': 1499.442976989403, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 68863.483734294045, + 'non_utility_expense': 4115.22633744856, + 'net_non_energy_opex': 72978.710071742607, + 'total_opex': 76974.819715398684, + 'noi': 46481.970408058129 + }, + 2021: { + 'year': 2021, + 'revenue': 130134.88313450124, + 'utility_expense': 76616.696522283994, + 'energy_opex': 4028.2111175084392, + 'electricity_opex': 1531.5444508417731, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 72588.485404775551, + 'non_utility_expense': 4337.829437816708, + 'net_non_energy_opex': 76926.314842592255, + 'total_opex': 80954.525960100698, + 'noi': 49180.357174400546 + }, + 2022: { + 'year': 2022, + 'revenue': 137174.21124828537, + 'utility_expense': 80572.264997622973, + 'energy_opex': 4057.2830706295772, + 'electricity_opex': 1560.6164039629107, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 76514.981926993394, + 'non_utility_expense': 4572.4737082761785, + 'net_non_energy_opex': 81087.45563526958, + 'total_opex': 85144.738705899159, + 'noi': 52029.472542386211 + }, + 2023: { + 'year': 2023, + 'revenue': 144594.3145938903, + 'utility_expense': 84739.644141653087, + 'energy_opex': 4085.7714696802459, + 'electricity_opex': 1589.1048030135796, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 80653.872671972844, + 'non_utility_expense': 4819.81048646301, + 'net_non_energy_opex': 85473.683158435859, + 'total_opex': 89559.454628116102, + 'noi': 55034.859965774202 + }, + 2024: { + 'year': 2024, + 'revenue': 152415.79027587266, + 'utility_expense': 89131.502637429046, + 'energy_opex': 4114.8560518808163, + 'electricity_opex': 1618.1893852141502, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 85016.646585548224, + 'non_utility_expense': 5080.526342529089, + 'net_non_energy_opex': 90097.172928077314, + 'total_opex': 94212.028979958137, + 'noi': 58203.761295914519 + }, + 2025: { + 'year': 2025, + 'revenue': 160660.349548767, + 'utility_expense': 93760.341878116174, + 'energy_opex': 4144.9277981463547, + 'electricity_opex': 1648.2611314796882, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 89615.414079969822, + 'non_utility_expense': 5355.3449849589, + 'net_non_energy_opex': 94970.759064928716, + 'total_opex': 99115.686863075069, + 'noi': 61544.662685691932 + }, + 2026: { + 'year': 2026, + 'revenue': 169350.87808430297, + 'utility_expense': 98640.181698797518, + 'energy_opex': 4177.2410481883689, + 'electricity_opex': 1680.5743815217027, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 94462.940650609147, + 'non_utility_expense': 5645.029269476766, + 'net_non_energy_opex': 100107.96992008592, + 'total_opex': 104285.21096827429, + 'noi': 65065.667116028679 + }, + 2027: { + 'year': 2027, + 'revenue': 178511.49949863003, + 'utility_expense': 103784.80808059855, + 'energy_opex': 4212.1257695209506, + 'electricity_opex': 1715.4591028542839, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 99572.682311077602, + 'non_utility_expense': 5950.383316621001, + 'net_non_energy_opex': 105523.0656276986, + 'total_opex': 109735.19139721955, + 'noi': 68776.308101410483 + }, + 2028: { + 'year': 2028, + 'revenue': 188167.6423158922, + 'utility_expense': 109206.76135193532, + 'energy_opex': 4247.9384068140234, + 'electricity_opex': 1751.2717401473571, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 104958.8229451213, + 'non_utility_expense': 6272.254743863074, + 'net_non_energy_opex': 111231.07768898437, + 'total_opex': 115479.01609579839, + 'noi': 72688.626220093822 + }, + 2029: { + 'year': 2029, + 'revenue': 198346.1105540334, + 'utility_expense': 114920.11497144966, + 'energy_opex': 4283.8012924745335, + 'electricity_opex': 1787.1346258078672, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 110636.31367897513, + 'non_utility_expense': 6611.5370184677795, + 'net_non_energy_opex': 117247.8506974429, + 'total_opex': 121531.65198991743, + 'noi': 76814.458564115965 + }, + 2030: { + 'year': 2030, + 'revenue': 209075.15812876914, + 'utility_expense': 120940.57693831145, + 'energy_opex': 4319.6625548433458, + 'electricity_opex': 1822.9958881766795, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 116620.9143834681, + 'non_utility_expense': 6969.171937625638, + 'net_non_energy_opex': 123590.08632109374, + 'total_opex': 127909.74887593709, + 'noi': 81165.409252832047 + }, + 2031: { + 'year': 2031, + 'revenue': 220384.56728225935, + 'utility_expense': 127284.86951679207, + 'energy_opex': 4355.63209570858, + 'electricity_opex': 1858.9654290419135, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 122929.23742108348, + 'non_utility_expense': 7346.152242741978, + 'net_non_energy_opex': 130275.38966382547, + 'total_opex': 134631.02175953405, + 'noi': 85753.545522725297 + }, + 2032: { + 'year': 2032, + 'revenue': 232305.73125418797, + 'utility_expense': 133970.79332894427, + 'energy_opex': 4391.9995695352491, + 'electricity_opex': 1895.3329028685823, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 129578.79375940903, + 'non_utility_expense': 7743.524375139598, + 'net_non_energy_opex': 137322.31813454864, + 'total_opex': 141714.31770408389, + 'noi': 90591.413550104073 + }, + 2033: { + 'year': 2033, + 'revenue': 244871.74142473264, + 'utility_expense': 141017.23028135113, + 'energy_opex': 4429.1887023694508, + 'electricity_opex': 1932.5220357027845, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 136588.04157898168, + 'non_utility_expense': 8162.3913808244215, + 'net_non_energy_opex': 144750.43295980609, + 'total_opex': 149179.62166217554, + 'noi': 95692.119762557093 + }, + 2034: { + 'year': 2034, + 'revenue': 258117.47917131998, + 'utility_expense': 148443.8093823333, + 'energy_opex': 4467.371871878835, + 'electricity_opex': 1970.7052052121689, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 143976.43751045447, + 'non_utility_expense': 8603.915972377332, + 'net_non_energy_opex': 152580.35348283179, + 'total_opex': 157047.72535471062, + 'noi': 101069.75381660936 + }, + 2035: { + 'year': 2035, + 'revenue': 272079.71269414737, + 'utility_expense': 156271.08719534514, + 'energy_opex': 4506.5965520321843, + 'electricity_opex': 2009.9298853655182, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 151764.49064331295, + 'non_utility_expense': 9069.323756471578, + 'net_non_energy_opex': 160833.81439978452, + 'total_opex': 165340.41095181671, + 'noi': 106739.30174233066 + }, + 2036: { + 'year': 2036, + 'revenue': 286797.19907924446, + 'utility_expense': 164520.68695453997, + 'energy_opex': 4546.8674984794106, + 'electricity_opex': 2050.2008318127446, + 'gas_opex': 1253.3333333333333, + 'oil_opex': 1243.3333333333333, + 'water_opex': 0, + 'other_utility': 159973.81945606056, + 'non_utility_expense': 9559.906635974816, + 'net_non_energy_opex': 169533.72609203539, + 'total_opex': 174080.59359051479, + 'noi': 112716.60548872966 + } +} + +next_year_income = { + 'year': 2017, + 'revenue': 105409.25533894598, + 'utility_expense': 63221.916617675291, + 'energy_opex': 4425.2434398071118, + 'electricity_opex': 1395.2434398071116, + 'gas_opex': 1520, + 'oil_opex': 1510, + 'water_opex': 0, + 'other_utility': 58796.673177868179, + 'non_utility_expense': 3513.6418446315324, + 'net_non_energy_opex': 62310.315022499708, + 'total_opex': 66735.558462306813, + 'noi': 38673.696876639166 +} + +average_income = { + 'year': None, + 'revenue': 95000.0, + 'utility_expense': 56666.666666666657, + 'energy_opex': 3676.2159331274047, + 'electricity_opex': 1357.327044238516, + 'gas_opex': 1164.4444444444443, + 'oil_opex': 1154.4444444444443, + 'water_opex': 0.0, + 'other_utility': 52990.450733539255, + 'non_utility_expense': 3166.6666666666665, + 'net_non_energy_opex': 56157.11740020592, + 'total_opex': 59833.333333333321, + 'noi': 35166.666666666679 +} diff --git a/bpfin/tests/test_utilbills/test_back_end_call.py b/bpfin/tests/test_utilbills/test_back_end_call.py index b991a09..dbe6460 100644 --- a/bpfin/tests/test_utilbills/test_back_end_call.py +++ b/bpfin/tests/test_utilbills/test_back_end_call.py @@ -1,4 +1,4 @@ -from bpfin.lib.back_end_call import monthly_bill, annual_bill, prior_income_statement +from bpfin.lib.back_end_call import monthly_bill, annual_bill, prior_income_statement_table from bpfin.tests.testdata import feature_data as db from bpfin.tests.testdata import sample_data as sdb @@ -24,7 +24,7 @@ def test_prior_income_statement(): output_next_year_income = db.next_year_income output_average_income = db.average_income output_historical_cagr = db.historical_cagr - prior_income, next_year_income, average_income, historical_cagr = prior_income_statement( + prior_income, next_year_income, average_income, historical_cagr = prior_income_statement_table( db.raw_income_input, # db.prior_annual_bill, db.raw_bill_table, diff --git a/bpfin/tests/testdata/feature_data.py b/bpfin/tests/testdata/feature_data.py index d9895af..5c82598 100644 --- a/bpfin/tests/testdata/feature_data.py +++ b/bpfin/tests/testdata/feature_data.py @@ -94,7 +94,7 @@ raw_bill_table = { # raw annual_bill -annual_bill_gas = {2014: 0, 2015: 1020, 2016: 1220, 2017: 1520} +annual_bill_gas = {2013: None, 2014: 0, 2015: 1020, 2016: 1220, 2017: 1520} annual_bill_oil = {2015: 1010, 2016: 1210, 2017: 1510} annual_bill_water = {2015: 0, 2016: 0, 2017: 0} raw_annual_bill_table = { @@ -167,7 +167,7 @@ prior_annual_bill = { 2036: 2050.2008318127446 }, 'gas': { - 2014: 0, + 2014: 1253.3333333333333, 2015: 1020, 2016: 1220, 2017: 1520, @@ -254,14 +254,14 @@ prior_income_statement_cagr = { 'year': 2014, 'revenue': 90000, 'utility_expense': 55000, - 'energy_opex': 2589.41283438579, - 'electricity_opex': 1346.079501052457, - 'gas_opex': 0, + 'energy_opex': 3842.7461677191232, + 'electricity_opex': 1346.0795010524571, + 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 52410.58716561421, + 'other_utility': 51157.253832280876, 'non_utility_expense': 3500, - 'net_non_energy_opex': 55910.58716561421, + 'net_non_energy_opex': 54657.253832280876, 'total_opex': 58500.0, 'noi': 31500.0 }, @@ -289,346 +289,347 @@ prior_income_statement_cagr = { 'gas_opex': 1220, 'oil_opex': 1210, 'water_opex': 0, - 'other_utility': 56201.53542802685, + 'other_utility': 56201.535428026851, 'non_utility_expense': 3000, - 'net_non_energy_opex': 59201.53542802685, + 'net_non_energy_opex': 59201.535428026851, 'total_opex': 63000.0, 'noi': 37000.0 }, 2017: { 'year': 2017, 'revenue': 105409.25533894598, - 'utility_expense': 63685.47076980913, - 'energy_opex': 4425.243439807112, + 'utility_expense': 63221.916617675291, + 'energy_opex': 4425.2434398071118, 'electricity_opex': 1395.2434398071116, 'gas_opex': 1520, 'oil_opex': 1510, 'water_opex': 0, - 'other_utility': 59260.22733000202, + 'other_utility': 58796.673177868179, 'non_utility_expense': 3513.6418446315324, - 'net_non_energy_opex': 62773.869174633546, - 'total_opex': 67199.11261444066, - 'noi': 38210.14272450532 + 'net_non_energy_opex': 62310.315022499708, + 'total_opex': 66735.558462306813, + 'noi': 38673.696876639166 }, 2018: { 'year': 2018, 'revenue': 111111.11111111112, - 'utility_expense': 66392.37014575081, - 'energy_opex': 3926.605805029146, + 'utility_expense': 65903.741165893778, + 'energy_opex': 3926.6058050291458, 'electricity_opex': 1429.9391383624793, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 62465.764340721675, + 'other_utility': 61977.135360864631, 'non_utility_expense': 3703.703703703704, - 'net_non_energy_opex': 66169.46804442538, - 'total_opex': 70096.07384945452, - 'noi': 41015.0372616566 + 'net_non_energy_opex': 65680.839064568339, + 'total_opex': 69607.444869597486, + 'noi': 41503.666241513638 }, 2019: { 'year': 2019, 'revenue': 117121.3948210511, - 'utility_expense': 69806.48568426503, - 'energy_opex': 3961.788650929455, + 'utility_expense': 69291.425515227427, + 'energy_opex': 3961.7886509294549, 'electricity_opex': 1465.1219842627888, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 65844.69703333559, + 'other_utility': 65329.63686429798, 'non_utility_expense': 3904.0464940350366, - 'net_non_energy_opex': 69748.74352737062, - 'total_opex': 73710.53217830008, - 'noi': 43410.86264275102 + 'net_non_energy_opex': 69233.683358333015, + 'total_opex': 73195.472009262478, + 'noi': 43925.922811788623 }, 2020: { 'year': 2020, 'revenue': 123456.79012345681, - 'utility_expense': 73402.51446668015, + 'utility_expense': 72859.593377950107, 'energy_opex': 3996.1096436560692, 'electricity_opex': 1499.442976989403, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 69406.40482302409, + 'other_utility': 68863.483734294045, 'non_utility_expense': 4115.22633744856, - 'net_non_energy_opex': 73521.63116047265, - 'total_opex': 77517.74080412873, - 'noi': 45939.049319328085 + 'net_non_energy_opex': 72978.710071742607, + 'total_opex': 76974.819715398684, + 'noi': 46481.970408058129 }, 2021: { 'year': 2021, 'revenue': 130134.88313450124, - 'utility_expense': 77188.98559899243, - 'energy_opex': 4028.211117508439, + 'utility_expense': 76616.696522283994, + 'energy_opex': 4028.2111175084392, 'electricity_opex': 1531.5444508417731, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 73160.77448148398, + 'other_utility': 72588.485404775551, 'non_utility_expense': 4337.829437816708, - 'net_non_energy_opex': 77498.60391930069, - 'total_opex': 81526.81503680913, - 'noi': 48608.068097692114 + 'net_non_energy_opex': 76926.314842592255, + 'total_opex': 80954.525960100698, + 'noi': 49180.357174400546 }, 2022: { 'year': 2022, 'revenue': 137174.21124828537, - 'utility_expense': 81175.51065176747, - 'energy_opex': 4057.283070629577, + 'utility_expense': 80572.264997622973, + 'energy_opex': 4057.2830706295772, 'electricity_opex': 1560.6164039629107, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 77118.2275811379, + 'other_utility': 76514.981926993394, 'non_utility_expense': 4572.4737082761785, - 'net_non_energy_opex': 81690.70128941408, - 'total_opex': 85747.98436004366, - 'noi': 51426.22688824171 + 'net_non_energy_opex': 81087.45563526958, + 'total_opex': 85144.738705899159, + 'noi': 52029.472542386211 }, 2023: { 'year': 2023, 'revenue': 144594.3145938903, - 'utility_expense': 85375.52089355137, - 'energy_opex': 4085.771469680246, + 'utility_expense': 84739.644141653087, + 'energy_opex': 4085.7714696802459, 'electricity_opex': 1589.1048030135796, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 81289.74942387112, + 'other_utility': 80653.872671972844, 'non_utility_expense': 4819.81048646301, - 'net_non_energy_opex': 86109.55991033414, - 'total_opex': 90195.33138001438, - 'noi': 54398.98321387592 + 'net_non_energy_opex': 85473.683158435859, + 'total_opex': 89559.454628116102, + 'noi': 55034.859965774202 }, 2024: { 'year': 2024, 'revenue': 152415.79027587266, - 'utility_expense': 89801.7755864785, - 'energy_opex': 4114.856051880816, + 'utility_expense': 89131.502637429046, + 'energy_opex': 4114.8560518808163, 'electricity_opex': 1618.1893852141502, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 85686.91953459768, + 'other_utility': 85016.646585548224, 'non_utility_expense': 5080.526342529089, - 'net_non_energy_opex': 90767.44587712677, - 'total_opex': 94882.30192900759, - 'noi': 57533.488346865066 + 'net_non_energy_opex': 90097.172928077314, + 'total_opex': 94212.028979958137, + 'noi': 58203.761295914519 }, 2025: { 'year': 2025, 'revenue': 160660.349548767, - 'utility_expense': 94466.87160244759, - 'energy_opex': 4144.927798146355, + 'utility_expense': 93760.341878116174, + 'energy_opex': 4144.9277981463547, 'electricity_opex': 1648.2611314796882, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 90321.94380430123, + 'other_utility': 89615.414079969822, 'non_utility_expense': 5355.3449849589, - 'net_non_energy_opex': 95677.28878926013, - 'total_opex': 99822.21658740648, - 'noi': 60838.13296136052 + 'net_non_energy_opex': 94970.759064928716, + 'total_opex': 99115.686863075069, + 'noi': 61544.662685691932 }, 2026: { 'year': 2026, 'revenue': 169350.87808430297, - 'utility_expense': 99384.92941996356, - 'energy_opex': 4177.241048188369, + 'utility_expense': 98640.181698797518, + 'energy_opex': 4177.2410481883689, 'electricity_opex': 1680.5743815217027, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 95207.68837177519, + 'other_utility': 94462.940650609147, 'non_utility_expense': 5645.029269476766, - 'net_non_energy_opex': 100852.71764125196, - 'total_opex': 105029.95868944033, - 'noi': 64320.919394862634 + 'net_non_energy_opex': 100107.96992008592, + 'total_opex': 104285.21096827429, + 'noi': 65065.667116028679 }, 2027: { 'year': 2027, 'revenue': 178511.49949863003, - 'utility_expense': 104569.84110763346, - 'energy_opex': 4212.125769520951, + 'utility_expense': 103784.80808059855, + 'energy_opex': 4212.1257695209506, 'electricity_opex': 1715.4591028542839, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 100357.71533811251, + 'other_utility': 99572.682311077602, 'non_utility_expense': 5950.383316621001, - 'net_non_energy_opex': 106308.0986547335, - 'total_opex': 110520.22442425445, - 'noi': 67991.27507437558 + 'net_non_energy_opex': 105523.0656276986, + 'total_opex': 109735.19139721955, + 'noi': 68776.308101410483 }, 2028: { 'year': 2028, 'revenue': 188167.6423158922, - 'utility_expense': 110034.25881989759, - 'energy_opex': 4247.938406814023, + 'utility_expense': 109206.76135193532, + 'energy_opex': 4247.9384068140234, 'electricity_opex': 1751.2717401473571, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 105786.32041308357, + 'other_utility': 104958.8229451213, 'non_utility_expense': 6272.254743863074, - 'net_non_energy_opex': 112058.57515694664, - 'total_opex': 116306.51356376066, - 'noi': 71861.12875213155 + 'net_non_energy_opex': 111231.07768898437, + 'total_opex': 115479.01609579839, + 'noi': 72688.626220093822 }, 2029: { 'year': 2029, 'revenue': 198346.1105540334, - 'utility_expense': 115792.37389037732, + 'utility_expense': 114920.11497144966, 'energy_opex': 4283.8012924745335, 'electricity_opex': 1787.1346258078672, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 111508.57259790279, + 'other_utility': 110636.31367897513, 'non_utility_expense': 6611.5370184677795, - 'net_non_energy_opex': 118120.10961637057, - 'total_opex': 122403.9109088451, - 'noi': 75942.1996451883 + 'net_non_energy_opex': 117247.8506974429, + 'total_opex': 121531.65198991743, + 'noi': 76814.458564115965 }, 2030: { 'year': 2030, 'revenue': 209075.15812876914, - 'utility_expense': 121860.01856938066, - 'energy_opex': 4319.662554843346, + 'utility_expense': 120940.57693831145, + 'energy_opex': 4319.6625548433458, 'electricity_opex': 1822.9958881766795, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 117540.3560145373, + 'other_utility': 116620.9143834681, 'non_utility_expense': 6969.171937625638, - 'net_non_energy_opex': 124509.52795216294, - 'total_opex': 128829.1905070063, - 'noi': 80245.96762176284 + 'net_non_energy_opex': 123590.08632109374, + 'total_opex': 127909.74887593709, + 'noi': 81165.409252832047 }, 2031: { 'year': 2031, 'revenue': 220384.56728225935, - 'utility_expense': 128254.04609337838, + 'utility_expense': 127284.86951679207, 'energy_opex': 4355.63209570858, 'electricity_opex': 1858.9654290419135, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 123898.41399766979, + 'other_utility': 122929.23742108348, 'non_utility_expense': 7346.152242741978, - 'net_non_energy_opex': 131244.56624041178, - 'total_opex': 135600.19833612035, - 'noi': 84784.368946139 + 'net_non_energy_opex': 130275.38966382547, + 'total_opex': 134631.02175953405, + 'noi': 85753.545522725297 }, 2032: { 'year': 2032, 'revenue': 232305.73125418797, - 'utility_expense': 134992.39514124338, - 'energy_opex': 4391.999569535249, + 'utility_expense': 133970.79332894427, + 'energy_opex': 4391.9995695352491, 'electricity_opex': 1895.3329028685823, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 130600.39557170814, + 'other_utility': 129578.79375940903, 'non_utility_expense': 7743.524375139598, - 'net_non_energy_opex': 138343.91994684775, - 'total_opex': 142735.919516383, - 'noi': 89569.81173780496 + 'net_non_energy_opex': 137322.31813454864, + 'total_opex': 141714.31770408389, + 'noi': 90591.413550104073 }, 2033: { 'year': 2033, 'revenue': 244871.74142473264, - 'utility_expense': 142094.09314422478, - 'energy_opex': 4429.188702369451, + 'utility_expense': 141017.23028135113, + 'energy_opex': 4429.1887023694508, 'electricity_opex': 1932.5220357027845, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 137664.90444185532, + 'other_utility': 136588.04157898168, 'non_utility_expense': 8162.3913808244215, - 'net_non_energy_opex': 145827.29582267973, - 'total_opex': 150256.4845250492, - 'noi': 94615.25689968345 + 'net_non_energy_opex': 144750.43295980609, + 'total_opex': 149179.62166217554, + 'noi': 95692.119762557093 }, 2034: { 'year': 2034, 'revenue': 258117.47917131998, - 'utility_expense': 149578.9225071101, + 'utility_expense': 148443.8093823333, 'energy_opex': 4467.371871878835, - 'electricity_opex': 1970.705205212169, + 'electricity_opex': 1970.7052052121689, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 145111.55063523128, + 'other_utility': 143976.43751045447, 'non_utility_expense': 8603.915972377332, - 'net_non_energy_opex': 153715.4666076086, - 'total_opex': 158182.83847948743, - 'noi': 99934.64069183255 + 'net_non_energy_opex': 152580.35348283179, + 'total_opex': 157047.72535471062, + 'noi': 101069.75381660936 }, 2035: { 'year': 2035, 'revenue': 272079.71269414737, - 'utility_expense': 157467.601487427, - 'energy_opex': 4506.596552032184, + 'utility_expense': 156271.08719534514, + 'energy_opex': 4506.5965520321843, 'electricity_opex': 2009.9298853655182, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 152961.0049353948, + 'other_utility': 151764.49064331295, 'non_utility_expense': 9069.323756471578, - 'net_non_energy_opex': 162030.32869186637, - 'total_opex': 166536.92524389856, - 'noi': 105542.78745024881 + 'net_non_energy_opex': 160833.81439978452, + 'total_opex': 165340.41095181671, + 'noi': 106739.30174233066 }, 2036: { 'year': 2036, 'revenue': 286797.19907924446, - 'utility_expense': 165781.9237598475, - 'energy_opex': 4546.867498479411, + 'utility_expense': 164520.68695453997, + 'energy_opex': 4546.8674984794106, 'electricity_opex': 2050.2008318127446, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, - 'other_utility': 161235.0562613681, + 'other_utility': 159973.81945606056, 'non_utility_expense': 9559.906635974816, - 'net_non_energy_opex': 170794.96289734292, - 'total_opex': 175341.83039582233, - 'noi': 111455.36868342213 + 'net_non_energy_opex': 169533.72609203539, + 'total_opex': 174080.59359051479, + 'noi': 112716.60548872966 } } next_year_income = { 'year': 2017, 'revenue': 105409.25533894598, - 'utility_expense': 63685.47076980913, - 'energy_opex': 4425.243439807112, + 'utility_expense': 63221.916617675291, + 'energy_opex': 4425.2434398071118, 'electricity_opex': 1395.2434398071116, 'gas_opex': 1520, 'oil_opex': 1510, 'water_opex': 0, - 'other_utility': 59260.22733000202, + 'other_utility': 58796.673177868179, 'non_utility_expense': 3513.6418446315324, - 'net_non_energy_opex': 62773.869174633546, - 'total_opex': 67199.11261444066, - 'noi': 38210.14272450532 + 'net_non_energy_opex': 62310.315022499708, + 'total_opex': 66735.558462306813, + 'noi': 38673.696876639166 } average_income = { 'year': None, 'revenue': 95000.0, 'utility_expense': 56666.666666666657, - 'energy_opex': 3258.4381553496269, + 'energy_opex': 3676.2159331274047, 'electricity_opex': 1357.327044238516, - 'gas_opex': 746.66666666666663, + 'gas_opex': 1164.4444444444443, 'oil_opex': 1154.4444444444443, 'water_opex': 0.0, - 'other_utility': 53408.228511317029, + 'other_utility': 52990.450733539255, 'non_utility_expense': 3166.6666666666665, - 'net_non_energy_opex': 56574.895177983693, + 'net_non_energy_opex': 56157.11740020592, 'total_opex': 59833.333333333321, 'noi': 35166.666666666679 } + historical_cagr = 0.05409255338945984 post_annual_bill_table = { diff --git a/bpfin/utilbills/bill.py b/bpfin/utilbills/bill.py index 161f54d..535e042 100644 --- a/bpfin/utilbills/bill.py +++ b/bpfin/utilbills/bill.py @@ -9,6 +9,7 @@ from bpfin.lib.other import form_date_calendar from bpfin.utilbills.bill_month_normalize_rough import bill_month_normalize_rough from bpfin.utilbills.bill_prior_proj_rough import bill_prior_proj_rough from bpfin.utilbills.inflation_sample_data import inflation_coeff_dict +from bpfin.lib.other import average_list_with_none # from bpfin.tests.testdata import feature_data as db @@ -57,12 +58,15 @@ def estimate_annual_bill(raw_annual_bill, analysis_date): average_charge = 0 annual_bill_dict = {} else: - average_charge = average_nonzero_list(raw_annual_bill.values()) + average_charge = average_list_with_none(raw_annual_bill.values()) + # average_charge = average_nonzero_list(raw_annual_bill.values()) annual_bill_dict = copy.deepcopy(raw_annual_bill) for year in proforma_year: if year not in annual_bill_dict: annual_bill_dict[year] = average_charge + if not annual_bill_dict[year]: + annual_bill_dict[year] = average_charge return annual_bill_dict diff --git a/data_generation.py b/data_generation.py new file mode 100644 index 0000000..0264c0f --- /dev/null +++ b/data_generation.py @@ -0,0 +1 @@ +({2014: {'year': 2014, 'revenue': 90000, 'utility_expense': 55000, 'energy_opex': 3842.7461677191232, 'electricity_opex': 1346.0795010524571, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 51157.253832280876, 'non_utility_expense': 3500, 'net_non_energy_opex': 54657.253832280876, 'total_opex': 58500.0, 'noi': 31500.0}, 2015: {'year': 2015, 'revenue': 95000, 'utility_expense': 55000, 'energy_opex': 3387.4370596899435, 'electricity_opex': 1357.4370596899435, 'gas_opex': 1020, 'oil_opex': 1010, 'water_opex': 0, 'other_utility': 51612.562940310054, 'non_utility_expense': 3000, 'net_non_energy_opex': 54612.562940310054, 'total_opex': 58000.0, 'noi': 37000.0}, 2016: {'year': 2016, 'revenue': 100000, 'utility_expense': 60000, 'energy_opex': 3798.4645719731475, 'electricity_opex': 1368.4645719731475, 'gas_opex': 1220, 'oil_opex': 1210, 'water_opex': 0, 'other_utility': 56201.535428026851, 'non_utility_expense': 3000, 'net_non_energy_opex': 59201.535428026851, 'total_opex': 63000.0, 'noi': 37000.0}, 2017: {'year': 2017, 'revenue': 105409.25533894598, 'utility_expense': 63221.916617675291, 'energy_opex': 4425.2434398071118, 'electricity_opex': 1395.2434398071116, 'gas_opex': 1520, 'oil_opex': 1510, 'water_opex': 0, 'other_utility': 58796.673177868179, 'non_utility_expense': 3513.6418446315324, 'net_non_energy_opex': 62310.315022499708, 'total_opex': 66735.558462306813, 'noi': 38673.696876639166}, 2018: {'year': 2018, 'revenue': 111111.11111111112, 'utility_expense': 65903.741165893778, 'energy_opex': 3926.6058050291458, 'electricity_opex': 1429.9391383624793, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 61977.135360864631, 'non_utility_expense': 3703.703703703704, 'net_non_energy_opex': 65680.839064568339, 'total_opex': 69607.444869597486, 'noi': 41503.666241513638}, 2019: {'year': 2019, 'revenue': 117121.3948210511, 'utility_expense': 69291.425515227427, 'energy_opex': 3961.7886509294549, 'electricity_opex': 1465.1219842627888, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 65329.63686429798, 'non_utility_expense': 3904.0464940350366, 'net_non_energy_opex': 69233.683358333015, 'total_opex': 73195.472009262478, 'noi': 43925.922811788623}, 2020: {'year': 2020, 'revenue': 123456.79012345681, 'utility_expense': 72859.593377950107, 'energy_opex': 3996.1096436560692, 'electricity_opex': 1499.442976989403, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 68863.483734294045, 'non_utility_expense': 4115.22633744856, 'net_non_energy_opex': 72978.710071742607, 'total_opex': 76974.819715398684, 'noi': 46481.970408058129}, 2021: {'year': 2021, 'revenue': 130134.88313450124, 'utility_expense': 76616.696522283994, 'energy_opex': 4028.2111175084392, 'electricity_opex': 1531.5444508417731, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 72588.485404775551, 'non_utility_expense': 4337.829437816708, 'net_non_energy_opex': 76926.314842592255, 'total_opex': 80954.525960100698, 'noi': 49180.357174400546}, 2022: {'year': 2022, 'revenue': 137174.21124828537, 'utility_expense': 80572.264997622973, 'energy_opex': 4057.2830706295772, 'electricity_opex': 1560.6164039629107, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 76514.981926993394, 'non_utility_expense': 4572.4737082761785, 'net_non_energy_opex': 81087.45563526958, 'total_opex': 85144.738705899159, 'noi': 52029.472542386211}, 2023: {'year': 2023, 'revenue': 144594.3145938903, 'utility_expense': 84739.644141653087, 'energy_opex': 4085.7714696802459, 'electricity_opex': 1589.1048030135796, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 80653.872671972844, 'non_utility_expense': 4819.81048646301, 'net_non_energy_opex': 85473.683158435859, 'total_opex': 89559.454628116102, 'noi': 55034.859965774202}, 2024: {'year': 2024, 'revenue': 152415.79027587266, 'utility_expense': 89131.502637429046, 'energy_opex': 4114.8560518808163, 'electricity_opex': 1618.1893852141502, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 85016.646585548224, 'non_utility_expense': 5080.526342529089, 'net_non_energy_opex': 90097.172928077314, 'total_opex': 94212.028979958137, 'noi': 58203.761295914519}, 2025: {'year': 2025, 'revenue': 160660.349548767, 'utility_expense': 93760.341878116174, 'energy_opex': 4144.9277981463547, 'electricity_opex': 1648.2611314796882, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 89615.414079969822, 'non_utility_expense': 5355.3449849589, 'net_non_energy_opex': 94970.759064928716, 'total_opex': 99115.686863075069, 'noi': 61544.662685691932}, 2026: {'year': 2026, 'revenue': 169350.87808430297, 'utility_expense': 98640.181698797518, 'energy_opex': 4177.2410481883689, 'electricity_opex': 1680.5743815217027, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 94462.940650609147, 'non_utility_expense': 5645.029269476766, 'net_non_energy_opex': 100107.96992008592, 'total_opex': 104285.21096827429, 'noi': 65065.667116028679}, 2027: {'year': 2027, 'revenue': 178511.49949863003, 'utility_expense': 103784.80808059855, 'energy_opex': 4212.1257695209506, 'electricity_opex': 1715.4591028542839, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 99572.682311077602, 'non_utility_expense': 5950.383316621001, 'net_non_energy_opex': 105523.0656276986, 'total_opex': 109735.19139721955, 'noi': 68776.308101410483}, 2028: {'year': 2028, 'revenue': 188167.6423158922, 'utility_expense': 109206.76135193532, 'energy_opex': 4247.9384068140234, 'electricity_opex': 1751.2717401473571, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 104958.8229451213, 'non_utility_expense': 6272.254743863074, 'net_non_energy_opex': 111231.07768898437, 'total_opex': 115479.01609579839, 'noi': 72688.626220093822}, 2029: {'year': 2029, 'revenue': 198346.1105540334, 'utility_expense': 114920.11497144966, 'energy_opex': 4283.8012924745335, 'electricity_opex': 1787.1346258078672, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 110636.31367897513, 'non_utility_expense': 6611.5370184677795, 'net_non_energy_opex': 117247.8506974429, 'total_opex': 121531.65198991743, 'noi': 76814.458564115965}, 2030: {'year': 2030, 'revenue': 209075.15812876914, 'utility_expense': 120940.57693831145, 'energy_opex': 4319.6625548433458, 'electricity_opex': 1822.9958881766795, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 116620.9143834681, 'non_utility_expense': 6969.171937625638, 'net_non_energy_opex': 123590.08632109374, 'total_opex': 127909.74887593709, 'noi': 81165.409252832047}, 2031: {'year': 2031, 'revenue': 220384.56728225935, 'utility_expense': 127284.86951679207, 'energy_opex': 4355.63209570858, 'electricity_opex': 1858.9654290419135, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 122929.23742108348, 'non_utility_expense': 7346.152242741978, 'net_non_energy_opex': 130275.38966382547, 'total_opex': 134631.02175953405, 'noi': 85753.545522725297}, 2032: {'year': 2032, 'revenue': 232305.73125418797, 'utility_expense': 133970.79332894427, 'energy_opex': 4391.9995695352491, 'electricity_opex': 1895.3329028685823, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 129578.79375940903, 'non_utility_expense': 7743.524375139598, 'net_non_energy_opex': 137322.31813454864, 'total_opex': 141714.31770408389, 'noi': 90591.413550104073}, 2033: {'year': 2033, 'revenue': 244871.74142473264, 'utility_expense': 141017.23028135113, 'energy_opex': 4429.1887023694508, 'electricity_opex': 1932.5220357027845, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 136588.04157898168, 'non_utility_expense': 8162.3913808244215, 'net_non_energy_opex': 144750.43295980609, 'total_opex': 149179.62166217554, 'noi': 95692.119762557093}, 2034: {'year': 2034, 'revenue': 258117.47917131998, 'utility_expense': 148443.8093823333, 'energy_opex': 4467.371871878835, 'electricity_opex': 1970.7052052121689, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 143976.43751045447, 'non_utility_expense': 8603.915972377332, 'net_non_energy_opex': 152580.35348283179, 'total_opex': 157047.72535471062, 'noi': 101069.75381660936}, 2035: {'year': 2035, 'revenue': 272079.71269414737, 'utility_expense': 156271.08719534514, 'energy_opex': 4506.5965520321843, 'electricity_opex': 2009.9298853655182, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 151764.49064331295, 'non_utility_expense': 9069.323756471578, 'net_non_energy_opex': 160833.81439978452, 'total_opex': 165340.41095181671, 'noi': 106739.30174233066}, 2036: {'year': 2036, 'revenue': 286797.19907924446, 'utility_expense': 164520.68695453997, 'energy_opex': 4546.8674984794106, 'electricity_opex': 2050.2008318127446, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 159973.81945606056, 'non_utility_expense': 9559.906635974816, 'net_non_energy_opex': 169533.72609203539, 'total_opex': 174080.59359051479, 'noi': 112716.60548872966}}, {'year': 2017, 'revenue': 105409.25533894598, 'utility_expense': 63221.916617675291, 'energy_opex': 4425.2434398071118, 'electricity_opex': 1395.2434398071116, 'gas_opex': 1520, 'oil_opex': 1510, 'water_opex': 0, 'other_utility': 58796.673177868179, 'non_utility_expense': 3513.6418446315324, 'net_non_energy_opex': 62310.315022499708, 'total_opex': 66735.558462306813, 'noi': 38673.696876639166}, {'year': None, 'revenue': 95000.0, 'utility_expense': 56666.666666666657, 'energy_opex': 3676.2159331274047, 'electricity_opex': 1357.327044238516, 'gas_opex': 1164.4444444444443, 'oil_opex': 1154.4444444444443, 'water_opex': 0.0, 'other_utility': 52990.450733539255, 'non_utility_expense': 3166.6666666666665, 'net_non_energy_opex': 56157.11740020592, 'total_opex': 59833.333333333321, 'noi': 35166.666666666679}, 0.05409255338945984) \ No newline at end of file -- GitLab From c4271c3fb12fe1d54df1591f9d797a3d1c96c3c2 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Tue, 23 May 2017 10:30:28 -0400 Subject: [PATCH 3/5] Minor Clean up for back end calls --- bpfin/lib/back_end_call.py | 58 +++++++++++++------ .../test_utilbills/test_back_end_call.py | 2 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/bpfin/lib/back_end_call.py b/bpfin/lib/back_end_call.py index 6b70fbf..6e20df5 100644 --- a/bpfin/lib/back_end_call.py +++ b/bpfin/lib/back_end_call.py @@ -1,6 +1,6 @@ from bpfin.utilbills.bill import Bill from bpfin.financials.financial_lib import Income_Statement_Table -from bpfin.tests.testdata import feature_data as db +# from bpfin.tests.testdata import feature_data as db # import pprint @@ -122,7 +122,12 @@ def annual_bill(raw_bill_table, raw_annual_bill_table, analysis_date): return annual_bill_table -def prior_income_statement_table(raw_income_input, raw_bill_table, raw_annual_bill_table, analysis_date, growth_rate_flag): +def prior_income_statement_table( + raw_income_input, + raw_bill_table, + raw_annual_bill_table, + analysis_date, + growth_rate_flag): """ Take in prior-annual_bill_table, and raw inputs of income statements Generate historical income statement, calculate its characters including CAGR and other percent ratios @@ -130,21 +135,36 @@ def prior_income_statement_table(raw_income_input, raw_bill_table, raw_annual_bi Args: raw_income_input (dictionary): dict of dict of incomplete income statement, for historical years. Key = year - annual_bill_table (dictionary): dictionary of dictionary of annual bills, for 4 utility_types + raw_bill_table (dictionary): dict of dict of raw_bill. Keys are utility types + raw_annual_bill_table (dictionary): dictionary of dictionary of annual bills, at lease 0 year data is required analysis_date (dictionary): proforma's starting date and the years of proforma growth_rate_flag (float): indicating assumed growth rate, -2.0 == cagr, -1.0 == historical average + Returns: - prior_income_statement (dictionary): dict of dict of prior_saving income statement. Key is year + prior_income (dictionary): dict of dict of prior_saving income statement. Key is year next_year_income (dictionary): next year income statement. Keys are income statement items. average_income (dictionary): single year income statement for historical average. Keys = income statement items historical_cagr (float): compound annual growth rate Description: raw_income_input = {2014: {'revenue': 90.0, 'utility_expense': 55.0, 'non_utility_expense': 35.0}, 2015:{},} - annual_bill_table = { - 'electricity': {2014: 100, 2015:200, ...}, - 'oil': dict of oil_bill, - 'gas': dict of gas_bill, + + raw_bill_table = { + 'electricity': { + 'date_from': list of date, + 'date_to', list of date, + 'usage', list of float, + 'charge', list of float + }, + 'gas': None, + 'oil': None, + 'water': None + } + + raw_annual_bill_table = { + 'electricity': None + 'gas': {2014: 100, 2015:200, ...}, + 'oil': {2014: 100, 2015:200, ...}, 'water': dict of water_bill} prior_income_statement = {2014: {'year': 2014, 'revenue': 100.0, ..., 'not': 5.0}, ... , 2016:{}} @@ -171,14 +191,14 @@ def prior_income_statement_table(raw_income_input, raw_bill_table, raw_annual_bi # db.analysis_date, # -2.0)) -result = prior_income_statement_table( - db.raw_income_input, - db.raw_bill_table, - db.raw_annual_bill_table, - db.analysis_date, - -2.0) - -writein = str(result) -f = open('data_generation.py', 'w') -f.write(writein) -f.close() +# result = prior_income_statement_table( +# db.raw_income_input, +# db.raw_bill_table, +# db.raw_annual_bill_table, +# db.analysis_date, +# -2.0) + +# writein = str(result) +# f = open('data_generation.py', 'w') +# f.write(writein) +# f.close() diff --git a/bpfin/tests/test_utilbills/test_back_end_call.py b/bpfin/tests/test_utilbills/test_back_end_call.py index dbe6460..8a8e695 100644 --- a/bpfin/tests/test_utilbills/test_back_end_call.py +++ b/bpfin/tests/test_utilbills/test_back_end_call.py @@ -19,7 +19,7 @@ def test_annual_bill(): assert output_dict == result_dict -def test_prior_income_statement(): +def test_prior_income_statement_table(): output_income_statement = db.prior_income_statement_cagr output_next_year_income = db.next_year_income output_average_income = db.average_income -- GitLab From 7f8f188d45fb2b5e5a8fb1bef714963956782dbe Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Tue, 23 May 2017 10:34:39 -0400 Subject: [PATCH 4/5] Clean data_generation --- bpfin/lib/data_generation.py | 379 ----------------------------------- 1 file changed, 379 deletions(-) diff --git a/bpfin/lib/data_generation.py b/bpfin/lib/data_generation.py index 0e889f6..e69de29 100644 --- a/bpfin/lib/data_generation.py +++ b/bpfin/lib/data_generation.py @@ -1,379 +0,0 @@ -prior_income_statement_cagr = { - 2014: { - 'year': 2014, - 'revenue': 90000, - 'utility_expense': 55000, - 'energy_opex': 3842.7461677191232, - 'electricity_opex': 1346.0795010524571, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 51157.253832280876, - 'non_utility_expense': 3500, - 'net_non_energy_opex': 54657.253832280876, - 'total_opex': 58500.0, - 'noi': 31500.0 - }, - 2015: { - 'year': 2015, - 'revenue': 95000, - 'utility_expense': 55000, - 'energy_opex': 3387.4370596899435, - 'electricity_opex': 1357.4370596899435, - 'gas_opex': 1020, - 'oil_opex': 1010, - 'water_opex': 0, - 'other_utility': 51612.562940310054, - 'non_utility_expense': 3000, - 'net_non_energy_opex': 54612.562940310054, - 'total_opex': 58000.0, - 'noi': 37000.0 - }, - 2016: { - 'year': 2016, - 'revenue': 100000, - 'utility_expense': 60000, - 'energy_opex': 3798.4645719731475, - 'electricity_opex': 1368.4645719731475, - 'gas_opex': 1220, - 'oil_opex': 1210, - 'water_opex': 0, - 'other_utility': 56201.535428026851, - 'non_utility_expense': 3000, - 'net_non_energy_opex': 59201.535428026851, - 'total_opex': 63000.0, - 'noi': 37000.0 - }, - 2017: { - 'year': 2017, - 'revenue': 105409.25533894598, - 'utility_expense': 63221.916617675291, - 'energy_opex': 4425.2434398071118, - 'electricity_opex': 1395.2434398071116, - 'gas_opex': 1520, - 'oil_opex': 1510, - 'water_opex': 0, - 'other_utility': 58796.673177868179, - 'non_utility_expense': 3513.6418446315324, - 'net_non_energy_opex': 62310.315022499708, - 'total_opex': 66735.558462306813, - 'noi': 38673.696876639166 - }, - 2018: { - 'year': 2018, - 'revenue': 111111.11111111112, - 'utility_expense': 65903.741165893778, - 'energy_opex': 3926.6058050291458, - 'electricity_opex': 1429.9391383624793, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 61977.135360864631, - 'non_utility_expense': 3703.703703703704, - 'net_non_energy_opex': 65680.839064568339, - 'total_opex': 69607.444869597486, - 'noi': 41503.666241513638 - }, - 2019: { - 'year': 2019, - 'revenue': 117121.3948210511, - 'utility_expense': 69291.425515227427, - 'energy_opex': 3961.7886509294549, - 'electricity_opex': 1465.1219842627888, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 65329.63686429798, - 'non_utility_expense': 3904.0464940350366, - 'net_non_energy_opex': 69233.683358333015, - 'total_opex': 73195.472009262478, - 'noi': 43925.922811788623 - }, - 2020: { - 'year': 2020, - 'revenue': 123456.79012345681, - 'utility_expense': 72859.593377950107, - 'energy_opex': 3996.1096436560692, - 'electricity_opex': 1499.442976989403, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 68863.483734294045, - 'non_utility_expense': 4115.22633744856, - 'net_non_energy_opex': 72978.710071742607, - 'total_opex': 76974.819715398684, - 'noi': 46481.970408058129 - }, - 2021: { - 'year': 2021, - 'revenue': 130134.88313450124, - 'utility_expense': 76616.696522283994, - 'energy_opex': 4028.2111175084392, - 'electricity_opex': 1531.5444508417731, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 72588.485404775551, - 'non_utility_expense': 4337.829437816708, - 'net_non_energy_opex': 76926.314842592255, - 'total_opex': 80954.525960100698, - 'noi': 49180.357174400546 - }, - 2022: { - 'year': 2022, - 'revenue': 137174.21124828537, - 'utility_expense': 80572.264997622973, - 'energy_opex': 4057.2830706295772, - 'electricity_opex': 1560.6164039629107, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 76514.981926993394, - 'non_utility_expense': 4572.4737082761785, - 'net_non_energy_opex': 81087.45563526958, - 'total_opex': 85144.738705899159, - 'noi': 52029.472542386211 - }, - 2023: { - 'year': 2023, - 'revenue': 144594.3145938903, - 'utility_expense': 84739.644141653087, - 'energy_opex': 4085.7714696802459, - 'electricity_opex': 1589.1048030135796, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 80653.872671972844, - 'non_utility_expense': 4819.81048646301, - 'net_non_energy_opex': 85473.683158435859, - 'total_opex': 89559.454628116102, - 'noi': 55034.859965774202 - }, - 2024: { - 'year': 2024, - 'revenue': 152415.79027587266, - 'utility_expense': 89131.502637429046, - 'energy_opex': 4114.8560518808163, - 'electricity_opex': 1618.1893852141502, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 85016.646585548224, - 'non_utility_expense': 5080.526342529089, - 'net_non_energy_opex': 90097.172928077314, - 'total_opex': 94212.028979958137, - 'noi': 58203.761295914519 - }, - 2025: { - 'year': 2025, - 'revenue': 160660.349548767, - 'utility_expense': 93760.341878116174, - 'energy_opex': 4144.9277981463547, - 'electricity_opex': 1648.2611314796882, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 89615.414079969822, - 'non_utility_expense': 5355.3449849589, - 'net_non_energy_opex': 94970.759064928716, - 'total_opex': 99115.686863075069, - 'noi': 61544.662685691932 - }, - 2026: { - 'year': 2026, - 'revenue': 169350.87808430297, - 'utility_expense': 98640.181698797518, - 'energy_opex': 4177.2410481883689, - 'electricity_opex': 1680.5743815217027, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 94462.940650609147, - 'non_utility_expense': 5645.029269476766, - 'net_non_energy_opex': 100107.96992008592, - 'total_opex': 104285.21096827429, - 'noi': 65065.667116028679 - }, - 2027: { - 'year': 2027, - 'revenue': 178511.49949863003, - 'utility_expense': 103784.80808059855, - 'energy_opex': 4212.1257695209506, - 'electricity_opex': 1715.4591028542839, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 99572.682311077602, - 'non_utility_expense': 5950.383316621001, - 'net_non_energy_opex': 105523.0656276986, - 'total_opex': 109735.19139721955, - 'noi': 68776.308101410483 - }, - 2028: { - 'year': 2028, - 'revenue': 188167.6423158922, - 'utility_expense': 109206.76135193532, - 'energy_opex': 4247.9384068140234, - 'electricity_opex': 1751.2717401473571, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 104958.8229451213, - 'non_utility_expense': 6272.254743863074, - 'net_non_energy_opex': 111231.07768898437, - 'total_opex': 115479.01609579839, - 'noi': 72688.626220093822 - }, - 2029: { - 'year': 2029, - 'revenue': 198346.1105540334, - 'utility_expense': 114920.11497144966, - 'energy_opex': 4283.8012924745335, - 'electricity_opex': 1787.1346258078672, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 110636.31367897513, - 'non_utility_expense': 6611.5370184677795, - 'net_non_energy_opex': 117247.8506974429, - 'total_opex': 121531.65198991743, - 'noi': 76814.458564115965 - }, - 2030: { - 'year': 2030, - 'revenue': 209075.15812876914, - 'utility_expense': 120940.57693831145, - 'energy_opex': 4319.6625548433458, - 'electricity_opex': 1822.9958881766795, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 116620.9143834681, - 'non_utility_expense': 6969.171937625638, - 'net_non_energy_opex': 123590.08632109374, - 'total_opex': 127909.74887593709, - 'noi': 81165.409252832047 - }, - 2031: { - 'year': 2031, - 'revenue': 220384.56728225935, - 'utility_expense': 127284.86951679207, - 'energy_opex': 4355.63209570858, - 'electricity_opex': 1858.9654290419135, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 122929.23742108348, - 'non_utility_expense': 7346.152242741978, - 'net_non_energy_opex': 130275.38966382547, - 'total_opex': 134631.02175953405, - 'noi': 85753.545522725297 - }, - 2032: { - 'year': 2032, - 'revenue': 232305.73125418797, - 'utility_expense': 133970.79332894427, - 'energy_opex': 4391.9995695352491, - 'electricity_opex': 1895.3329028685823, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 129578.79375940903, - 'non_utility_expense': 7743.524375139598, - 'net_non_energy_opex': 137322.31813454864, - 'total_opex': 141714.31770408389, - 'noi': 90591.413550104073 - }, - 2033: { - 'year': 2033, - 'revenue': 244871.74142473264, - 'utility_expense': 141017.23028135113, - 'energy_opex': 4429.1887023694508, - 'electricity_opex': 1932.5220357027845, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 136588.04157898168, - 'non_utility_expense': 8162.3913808244215, - 'net_non_energy_opex': 144750.43295980609, - 'total_opex': 149179.62166217554, - 'noi': 95692.119762557093 - }, - 2034: { - 'year': 2034, - 'revenue': 258117.47917131998, - 'utility_expense': 148443.8093823333, - 'energy_opex': 4467.371871878835, - 'electricity_opex': 1970.7052052121689, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 143976.43751045447, - 'non_utility_expense': 8603.915972377332, - 'net_non_energy_opex': 152580.35348283179, - 'total_opex': 157047.72535471062, - 'noi': 101069.75381660936 - }, - 2035: { - 'year': 2035, - 'revenue': 272079.71269414737, - 'utility_expense': 156271.08719534514, - 'energy_opex': 4506.5965520321843, - 'electricity_opex': 2009.9298853655182, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 151764.49064331295, - 'non_utility_expense': 9069.323756471578, - 'net_non_energy_opex': 160833.81439978452, - 'total_opex': 165340.41095181671, - 'noi': 106739.30174233066 - }, - 2036: { - 'year': 2036, - 'revenue': 286797.19907924446, - 'utility_expense': 164520.68695453997, - 'energy_opex': 4546.8674984794106, - 'electricity_opex': 2050.2008318127446, - 'gas_opex': 1253.3333333333333, - 'oil_opex': 1243.3333333333333, - 'water_opex': 0, - 'other_utility': 159973.81945606056, - 'non_utility_expense': 9559.906635974816, - 'net_non_energy_opex': 169533.72609203539, - 'total_opex': 174080.59359051479, - 'noi': 112716.60548872966 - } -} - -next_year_income = { - 'year': 2017, - 'revenue': 105409.25533894598, - 'utility_expense': 63221.916617675291, - 'energy_opex': 4425.2434398071118, - 'electricity_opex': 1395.2434398071116, - 'gas_opex': 1520, - 'oil_opex': 1510, - 'water_opex': 0, - 'other_utility': 58796.673177868179, - 'non_utility_expense': 3513.6418446315324, - 'net_non_energy_opex': 62310.315022499708, - 'total_opex': 66735.558462306813, - 'noi': 38673.696876639166 -} - -average_income = { - 'year': None, - 'revenue': 95000.0, - 'utility_expense': 56666.666666666657, - 'energy_opex': 3676.2159331274047, - 'electricity_opex': 1357.327044238516, - 'gas_opex': 1164.4444444444443, - 'oil_opex': 1154.4444444444443, - 'water_opex': 0.0, - 'other_utility': 52990.450733539255, - 'non_utility_expense': 3166.6666666666665, - 'net_non_energy_opex': 56157.11740020592, - 'total_opex': 59833.333333333321, - 'noi': 35166.666666666679 -} -- GitLab From e766c549b9d6787fb8d8e22aa85ef7c976f60e16 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Tue, 23 May 2017 10:39:30 -0400 Subject: [PATCH 5/5] delete data_generation --- data_generation.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 data_generation.py diff --git a/data_generation.py b/data_generation.py deleted file mode 100644 index 0264c0f..0000000 --- a/data_generation.py +++ /dev/null @@ -1 +0,0 @@ -({2014: {'year': 2014, 'revenue': 90000, 'utility_expense': 55000, 'energy_opex': 3842.7461677191232, 'electricity_opex': 1346.0795010524571, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 51157.253832280876, 'non_utility_expense': 3500, 'net_non_energy_opex': 54657.253832280876, 'total_opex': 58500.0, 'noi': 31500.0}, 2015: {'year': 2015, 'revenue': 95000, 'utility_expense': 55000, 'energy_opex': 3387.4370596899435, 'electricity_opex': 1357.4370596899435, 'gas_opex': 1020, 'oil_opex': 1010, 'water_opex': 0, 'other_utility': 51612.562940310054, 'non_utility_expense': 3000, 'net_non_energy_opex': 54612.562940310054, 'total_opex': 58000.0, 'noi': 37000.0}, 2016: {'year': 2016, 'revenue': 100000, 'utility_expense': 60000, 'energy_opex': 3798.4645719731475, 'electricity_opex': 1368.4645719731475, 'gas_opex': 1220, 'oil_opex': 1210, 'water_opex': 0, 'other_utility': 56201.535428026851, 'non_utility_expense': 3000, 'net_non_energy_opex': 59201.535428026851, 'total_opex': 63000.0, 'noi': 37000.0}, 2017: {'year': 2017, 'revenue': 105409.25533894598, 'utility_expense': 63221.916617675291, 'energy_opex': 4425.2434398071118, 'electricity_opex': 1395.2434398071116, 'gas_opex': 1520, 'oil_opex': 1510, 'water_opex': 0, 'other_utility': 58796.673177868179, 'non_utility_expense': 3513.6418446315324, 'net_non_energy_opex': 62310.315022499708, 'total_opex': 66735.558462306813, 'noi': 38673.696876639166}, 2018: {'year': 2018, 'revenue': 111111.11111111112, 'utility_expense': 65903.741165893778, 'energy_opex': 3926.6058050291458, 'electricity_opex': 1429.9391383624793, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 61977.135360864631, 'non_utility_expense': 3703.703703703704, 'net_non_energy_opex': 65680.839064568339, 'total_opex': 69607.444869597486, 'noi': 41503.666241513638}, 2019: {'year': 2019, 'revenue': 117121.3948210511, 'utility_expense': 69291.425515227427, 'energy_opex': 3961.7886509294549, 'electricity_opex': 1465.1219842627888, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 65329.63686429798, 'non_utility_expense': 3904.0464940350366, 'net_non_energy_opex': 69233.683358333015, 'total_opex': 73195.472009262478, 'noi': 43925.922811788623}, 2020: {'year': 2020, 'revenue': 123456.79012345681, 'utility_expense': 72859.593377950107, 'energy_opex': 3996.1096436560692, 'electricity_opex': 1499.442976989403, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 68863.483734294045, 'non_utility_expense': 4115.22633744856, 'net_non_energy_opex': 72978.710071742607, 'total_opex': 76974.819715398684, 'noi': 46481.970408058129}, 2021: {'year': 2021, 'revenue': 130134.88313450124, 'utility_expense': 76616.696522283994, 'energy_opex': 4028.2111175084392, 'electricity_opex': 1531.5444508417731, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 72588.485404775551, 'non_utility_expense': 4337.829437816708, 'net_non_energy_opex': 76926.314842592255, 'total_opex': 80954.525960100698, 'noi': 49180.357174400546}, 2022: {'year': 2022, 'revenue': 137174.21124828537, 'utility_expense': 80572.264997622973, 'energy_opex': 4057.2830706295772, 'electricity_opex': 1560.6164039629107, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 76514.981926993394, 'non_utility_expense': 4572.4737082761785, 'net_non_energy_opex': 81087.45563526958, 'total_opex': 85144.738705899159, 'noi': 52029.472542386211}, 2023: {'year': 2023, 'revenue': 144594.3145938903, 'utility_expense': 84739.644141653087, 'energy_opex': 4085.7714696802459, 'electricity_opex': 1589.1048030135796, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 80653.872671972844, 'non_utility_expense': 4819.81048646301, 'net_non_energy_opex': 85473.683158435859, 'total_opex': 89559.454628116102, 'noi': 55034.859965774202}, 2024: {'year': 2024, 'revenue': 152415.79027587266, 'utility_expense': 89131.502637429046, 'energy_opex': 4114.8560518808163, 'electricity_opex': 1618.1893852141502, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 85016.646585548224, 'non_utility_expense': 5080.526342529089, 'net_non_energy_opex': 90097.172928077314, 'total_opex': 94212.028979958137, 'noi': 58203.761295914519}, 2025: {'year': 2025, 'revenue': 160660.349548767, 'utility_expense': 93760.341878116174, 'energy_opex': 4144.9277981463547, 'electricity_opex': 1648.2611314796882, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 89615.414079969822, 'non_utility_expense': 5355.3449849589, 'net_non_energy_opex': 94970.759064928716, 'total_opex': 99115.686863075069, 'noi': 61544.662685691932}, 2026: {'year': 2026, 'revenue': 169350.87808430297, 'utility_expense': 98640.181698797518, 'energy_opex': 4177.2410481883689, 'electricity_opex': 1680.5743815217027, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 94462.940650609147, 'non_utility_expense': 5645.029269476766, 'net_non_energy_opex': 100107.96992008592, 'total_opex': 104285.21096827429, 'noi': 65065.667116028679}, 2027: {'year': 2027, 'revenue': 178511.49949863003, 'utility_expense': 103784.80808059855, 'energy_opex': 4212.1257695209506, 'electricity_opex': 1715.4591028542839, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 99572.682311077602, 'non_utility_expense': 5950.383316621001, 'net_non_energy_opex': 105523.0656276986, 'total_opex': 109735.19139721955, 'noi': 68776.308101410483}, 2028: {'year': 2028, 'revenue': 188167.6423158922, 'utility_expense': 109206.76135193532, 'energy_opex': 4247.9384068140234, 'electricity_opex': 1751.2717401473571, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 104958.8229451213, 'non_utility_expense': 6272.254743863074, 'net_non_energy_opex': 111231.07768898437, 'total_opex': 115479.01609579839, 'noi': 72688.626220093822}, 2029: {'year': 2029, 'revenue': 198346.1105540334, 'utility_expense': 114920.11497144966, 'energy_opex': 4283.8012924745335, 'electricity_opex': 1787.1346258078672, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 110636.31367897513, 'non_utility_expense': 6611.5370184677795, 'net_non_energy_opex': 117247.8506974429, 'total_opex': 121531.65198991743, 'noi': 76814.458564115965}, 2030: {'year': 2030, 'revenue': 209075.15812876914, 'utility_expense': 120940.57693831145, 'energy_opex': 4319.6625548433458, 'electricity_opex': 1822.9958881766795, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 116620.9143834681, 'non_utility_expense': 6969.171937625638, 'net_non_energy_opex': 123590.08632109374, 'total_opex': 127909.74887593709, 'noi': 81165.409252832047}, 2031: {'year': 2031, 'revenue': 220384.56728225935, 'utility_expense': 127284.86951679207, 'energy_opex': 4355.63209570858, 'electricity_opex': 1858.9654290419135, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 122929.23742108348, 'non_utility_expense': 7346.152242741978, 'net_non_energy_opex': 130275.38966382547, 'total_opex': 134631.02175953405, 'noi': 85753.545522725297}, 2032: {'year': 2032, 'revenue': 232305.73125418797, 'utility_expense': 133970.79332894427, 'energy_opex': 4391.9995695352491, 'electricity_opex': 1895.3329028685823, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 129578.79375940903, 'non_utility_expense': 7743.524375139598, 'net_non_energy_opex': 137322.31813454864, 'total_opex': 141714.31770408389, 'noi': 90591.413550104073}, 2033: {'year': 2033, 'revenue': 244871.74142473264, 'utility_expense': 141017.23028135113, 'energy_opex': 4429.1887023694508, 'electricity_opex': 1932.5220357027845, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 136588.04157898168, 'non_utility_expense': 8162.3913808244215, 'net_non_energy_opex': 144750.43295980609, 'total_opex': 149179.62166217554, 'noi': 95692.119762557093}, 2034: {'year': 2034, 'revenue': 258117.47917131998, 'utility_expense': 148443.8093823333, 'energy_opex': 4467.371871878835, 'electricity_opex': 1970.7052052121689, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 143976.43751045447, 'non_utility_expense': 8603.915972377332, 'net_non_energy_opex': 152580.35348283179, 'total_opex': 157047.72535471062, 'noi': 101069.75381660936}, 2035: {'year': 2035, 'revenue': 272079.71269414737, 'utility_expense': 156271.08719534514, 'energy_opex': 4506.5965520321843, 'electricity_opex': 2009.9298853655182, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 151764.49064331295, 'non_utility_expense': 9069.323756471578, 'net_non_energy_opex': 160833.81439978452, 'total_opex': 165340.41095181671, 'noi': 106739.30174233066}, 2036: {'year': 2036, 'revenue': 286797.19907924446, 'utility_expense': 164520.68695453997, 'energy_opex': 4546.8674984794106, 'electricity_opex': 2050.2008318127446, 'gas_opex': 1253.3333333333333, 'oil_opex': 1243.3333333333333, 'water_opex': 0, 'other_utility': 159973.81945606056, 'non_utility_expense': 9559.906635974816, 'net_non_energy_opex': 169533.72609203539, 'total_opex': 174080.59359051479, 'noi': 112716.60548872966}}, {'year': 2017, 'revenue': 105409.25533894598, 'utility_expense': 63221.916617675291, 'energy_opex': 4425.2434398071118, 'electricity_opex': 1395.2434398071116, 'gas_opex': 1520, 'oil_opex': 1510, 'water_opex': 0, 'other_utility': 58796.673177868179, 'non_utility_expense': 3513.6418446315324, 'net_non_energy_opex': 62310.315022499708, 'total_opex': 66735.558462306813, 'noi': 38673.696876639166}, {'year': None, 'revenue': 95000.0, 'utility_expense': 56666.666666666657, 'energy_opex': 3676.2159331274047, 'electricity_opex': 1357.327044238516, 'gas_opex': 1164.4444444444443, 'oil_opex': 1154.4444444444443, 'water_opex': 0.0, 'other_utility': 52990.450733539255, 'non_utility_expense': 3166.6666666666665, 'net_non_energy_opex': 56157.11740020592, 'total_opex': 59833.333333333321, 'noi': 35166.666666666679}, 0.05409255338945984) \ No newline at end of file -- GitLab