Skip to content

Commit b82e1e2

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3fb6f0f commit b82e1e2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

financial/amortization_table.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import pandas as pd
1111

12+
1213
def payment(principal: float, interest_rate: float, payments: int) -> float:
1314
"""
1415
Calculate the monthly payment for a loan.
@@ -36,7 +37,10 @@ def payment(principal: float, interest_rate: float, payments: int) -> float:
3637

3738
return payment
3839

39-
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:
4044
"""
4145
Create an amortization table for a loan.
4246
@@ -75,7 +79,12 @@ def amortization_table(principal: float, interest_rate: float, years: int) -> pd
7579
payments = years * 12
7680
interest_rate /= 12
7781
payment_amount = payment(principal, interest_rate, payments)
78-
df = pd.DataFrame(index=range(0, payments + 1), columns=["Payment", "Principal", "Interest", "Remaining"], dtype="float", data=0)
82+
df = pd.DataFrame(
83+
index=range(0, payments + 1),
84+
columns=["Payment", "Principal", "Interest", "Remaining"],
85+
dtype="float",
86+
data=0,
87+
)
7988

8089
df["Payment"][1:] = payment_amount
8190
df["Remaining"][0] = principal
@@ -89,8 +98,7 @@ def amortization_table(principal: float, interest_rate: float, years: int) -> pd
8998
return df
9099

91100

92-
93101
if __name__ == "__main__":
94102
import doctest
95103

96-
doctest.testmod()
104+
doctest.testmod()

0 commit comments

Comments
 (0)