Skip to content

Commit 4115de4

Browse files
author
Marks Mac
committed
Merge branch 'master' of github.com:marktheawesome/Python
2 parents 36a8632 + b82e1e2 commit 4115de4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

financial/amortization_table.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ def payment(principal: float, interest_rate: float, payments: int) -> float:
3737

3838
return payment
3939

40-
def amortization_table(principal: float, interest_rate: float, years: int) -> pd.DataFrame:
40+
41+
def amortization_table(
42+
principal: float, interest_rate: float, years: int
43+
) -> pd.DataFrame:
4144
"""
4245
Create an amortization table for a loan.
4346
@@ -76,7 +79,7 @@ def amortization_table(principal: float, interest_rate: float, years: int) -> pd
7679
payments = years * 12
7780
interest_rate /= 12
7881
payment_amount = payment(principal, interest_rate, payments)
79-
amor_table = pd.DataFrame(index=range(0, payments + 1), columns=["Payment", "Principal", "Interest", "Remaining"], dtype="float", data=0)
82+
df = pd.DataFrame(index=range(0, payments + 1), columns=["Payment", "Principal", "Interest", "Remaining"], dtype="float", data=0)
8083

8184
amor_table["Payment"][1:] = payment_amount
8285
amor_table["Remaining"][0] = principal
@@ -90,7 +93,6 @@ def amortization_table(principal: float, interest_rate: float, years: int) -> pd
9093
return amor_table
9194

9295

93-
9496
if __name__ == "__main__":
9597
import doctest
9698

0 commit comments

Comments
 (0)