Update app.py
Browse files
app.py
CHANGED
|
@@ -86,24 +86,34 @@ def calculate_differentiated_payment(loan_amount, interest_rate, loan_term):
|
|
| 86 |
|
| 87 |
return total_payment / loan_term
|
| 88 |
|
| 89 |
-
def save_to_file(income, loan_payments, has_guarantors, loan_term, interest_rate,
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
if __name__ == "__main__":
|
| 109 |
main()
|
|
|
|
| 86 |
|
| 87 |
return total_payment / loan_term
|
| 88 |
|
| 89 |
+
def save_to_file(income, loan_payments, has_guarantors, loan_term, interest_rate,
|
| 90 |
+
preferential_rate, monthly_payment, start_date, end_date,
|
| 91 |
+
desired_loan_amount, max_monthly_payment, max_loan_amount, payment_type):
|
| 92 |
+
# Создание DataFrame с результатами расчета
|
| 93 |
+
data = {
|
| 94 |
+
"Сумма кредита": [desired_loan_amount],
|
| 95 |
+
"Срок (мес.)": [loan_term],
|
| 96 |
+
"Процентная ставка (%)": [interest_rate],
|
| 97 |
+
"Ежемесячный платеж": [monthly_payment],
|
| 98 |
+
"Дата начала": [start_date],
|
| 99 |
+
"Дата окончания": [end_date],
|
| 100 |
+
"Максимальный ежемесячный платеж": [max_monthly_payment],
|
| 101 |
+
"Максимальная сумма кредита": [max_loan_amount],
|
| 102 |
+
"Тип платежа": [payment_type],
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
df = pd.DataFrame(data)
|
| 106 |
+
|
| 107 |
+
# Запись в CSV
|
| 108 |
+
csv = df.to_csv(index=False)
|
| 109 |
+
|
| 110 |
+
# Сохранение файла в память
|
| 111 |
+
st.download_button(
|
| 112 |
+
label="Скачать результаты",
|
| 113 |
+
data=csv,
|
| 114 |
+
file_name='loan_calculation_results.csv',
|
| 115 |
+
mime='text/csv'
|
| 116 |
+
)
|
| 117 |
|
| 118 |
if __name__ == "__main__":
|
| 119 |
main()
|