LuisLozano commited on
Commit
0c25188
1 Parent(s): 92ac1b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -1,4 +1,6 @@
1
  import streamlit as st
 
 
2
 
3
  A = st.number_input(
4
  "Insert the initial investment (in $): "
@@ -7,10 +9,24 @@ r = st.number_input(
7
  "Insert the interest rate (nominal in %): "
8
  )
9
  T = st.number_input(
10
- "Insert the number of years of your investment: ",
11
  step=1
12
  )
13
 
14
- y = A * (1 + (r/100))**T
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  st.write(f"Your money after {T} years is ${y:.2f}")
 
1
  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 $): "
 
9
  "Insert the interest rate (nominal in %): "
10
  )
11
  T = st.number_input(
12
+ "Insert the number of months of your investment: ",
13
  step=1
14
  )
15
 
16
+ # Numpy array with the months
17
+ t = np.arange(T + 1)
18
+
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)
28
+ 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}")