Spaces:
Runtime error
Runtime error
Commit
•
ec48dca
1
Parent(s):
0c25188
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import streamlit as st
|
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
4 |
|
|
|
|
|
5 |
A = st.number_input(
|
6 |
"Insert the initial investment (in $): "
|
7 |
)
|
@@ -19,9 +21,13 @@ t = np.arange(T + 1)
|
|
19 |
# Numpy array with the returns for each month in t
|
20 |
y = A * (1 + (r/(12*100)))**t
|
21 |
|
|
|
|
|
|
|
22 |
# Create the investment dictionary
|
23 |
inv_dict = {"Month": t,
|
24 |
-
"Returns": y
|
|
|
25 |
|
26 |
# Create the investment dataframe
|
27 |
inv_df = pd.DataFrame(inv_dict)
|
@@ -29,4 +35,3 @@ inv_df.columns = inv_dict.keys()
|
|
29 |
|
30 |
st.dataframe(inv_df)
|
31 |
|
32 |
-
st.write(f"Your money after {T} years is ${y:.2f}")
|
|
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
4 |
|
5 |
+
st.title("Investment app 💼")
|
6 |
+
|
7 |
A = st.number_input(
|
8 |
"Insert the initial investment (in $): "
|
9 |
)
|
|
|
21 |
# Numpy array with the returns for each month in t
|
22 |
y = A * (1 + (r/(12*100)))**t
|
23 |
|
24 |
+
# Numpy array with the continuously compunded returns
|
25 |
+
y_c = A * np.exp(r * t / (12*100))
|
26 |
+
|
27 |
# Create the investment dictionary
|
28 |
inv_dict = {"Month": t,
|
29 |
+
"Returns": y,
|
30 |
+
"Continuous returns": y_c}
|
31 |
|
32 |
# Create the investment dataframe
|
33 |
inv_df = pd.DataFrame(inv_dict)
|
|
|
35 |
|
36 |
st.dataframe(inv_df)
|
37 |
|
|