diff --git a/bpfin/financials/borrower_schedule.py b/bpfin/financials/borrower_schedule.py new file mode 100644 index 0000000000000000000000000000000000000000..a9b59ac5023b77151859c7d3a074bc9bf193c099 --- /dev/null +++ b/bpfin/financials/borrower_schedule.py @@ -0,0 +1,66 @@ +import matplotlib.pyplot as plt +import pandas as pd +import numpy as np + + +def packaging_data(analysis_date, energy_expenses, loan_input, savings_input): + + analysis_years = {} + + for date in analysis_date: + start_year = date.year + duration = analysis_date[date] + for i in range(duration): + analysis_years[start_year + i] = [] + + for year in analysis_years: + data_storage = {} + if year in energy_expenses: + data_storage['energy_expenses'] = energy_expenses[year] + if year in loan_input: + data_storage['loan_input'] = loan_input[year] + if year in savings_input: + data_storage['savings_input'] = savings_input[year] + analysis_years[year] = data_storage + + return analysis_years + + # raw_data = { + # 'years': years, + # 'energy_expenses': energy_expenses, + # 'loan_input': loan_input, + # 'savings_input': savings_input + # } + # df = pd.DataFrame( + # raw_data, + # columns=['years', 'energy_expenses', 'loan_input', 'savings_input']) + # f, ax1 = plt.subplots(1, figsize(10, 5)) + # bar_width = 0.75 + # bar_l = [i + 1 for i in range(len(df['energy_expenses']))] + # tick_pos = [i + (bar_width / 2) for i in bar_l] + # ax1.bar( + # bar_l, + # df['energy_expenses'], + # width=bar_width, + # label='Energy Expenses', + # alpha=0.5, + # color='#F4561D') + # ax1.bar( + # bar_l, + # df['loan_input'], + # width=bar_width, + # label='Loan Value', + # alpha=0.5, + # color='#F1911E') + # ax1.bar( + # bar_l, + # df['savings_input'], + # width=bar_width, + # label='Net Savings to Customer', + # alpha=0.5, + # color='#F1BD1A') + # plt.xticks(tick_pos, df['year']) + # ax1.set_ylabel("$") + # ax1.set_xlabel("Year") + # plt.legend(loc='upper left') + # plt.xlim([min(tick_pos) - bar_width, max(tick_pos) + bar_width]) diff --git a/bpfin/financials/cash_balance.py b/bpfin/financials/cash_balance.py index a73675ddcd9846753020e2c11143c358f7b25cd6..55cd11cae1d32dc29efe30003176f65c543f3a3e 100644 --- a/bpfin/financials/cash_balance.py +++ b/bpfin/financials/cash_balance.py @@ -21,5 +21,5 @@ def cash_balance(cash_dictionary): for year, value in bank_statement.items(): if year not in cash_balance_dictionary: - cash_balance_dictionary[year] = sum(value)/len(value) + cash_balance_dictionary[year] = sum(value) / len(value) return cash_balance_dictionary