Skip to content

Commit 9e776e1

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4115de4 commit 9e776e1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

financial/amortization_table.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,23 @@ def amortization_table(
7979
payments = years * 12
8080
interest_rate /= 12
8181
payment_amount = payment(principal, interest_rate, payments)
82-
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+
)
8388

8489
amor_table["Payment"][1:] = payment_amount
8590
amor_table["Remaining"][0] = principal
8691
for i in range(1, payments + 1):
8792
amor_table["Interest"][i] = amor_table["Remaining"][i - 1] * interest_rate
88-
amor_table["Principal"][i] = amor_table["Payment"][i] - amor_table["Interest"][i]
89-
amor_table["Remaining"][i] = amor_table["Remaining"][i - 1] - amor_table["Principal"][i]
93+
amor_table["Principal"][i] = (
94+
amor_table["Payment"][i] - amor_table["Interest"][i]
95+
)
96+
amor_table["Remaining"][i] = (
97+
amor_table["Remaining"][i - 1] - amor_table["Principal"][i]
98+
)
9099
amor_table = amor_table.round(2)
91100
amor_table = amor_table.abs()
92101

0 commit comments

Comments
 (0)