Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -3,50 +3,45 @@ import numpy as np
|
|
3 |
import matplotlib.pyplot as plt
|
4 |
|
5 |
def analizar_inversiones(lista1, lista2):
|
6 |
-
array1 = np.array(lista1)
|
7 |
-
array2 = np.array(lista2)
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
ax.
|
23 |
-
|
24 |
-
ax.set_ylabel('Lista 2')
|
25 |
-
ax.set_title('Investment graph')
|
26 |
-
ax.grid(True)
|
27 |
-
st.pyplot(fig)
|
28 |
|
29 |
# Decidir a cuál invertir más y a cuál menos
|
30 |
-
if mean1 > mean2:
|
31 |
-
|
32 |
-
|
33 |
-
else:
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
st.write("
|
39 |
-
st.write(f"Standar desviation of list
|
40 |
-
st.write(f"
|
41 |
-
st.write(f"Estimated value list
|
42 |
-
st.write(f"
|
43 |
-
st.write(f"
|
44 |
-
st.write(f"Invest
|
45 |
-
st.write(f"Invest less in: {invertir_menos}")
|
46 |
|
47 |
def main():
|
48 |
-
st.title("Variance Portfolio")
|
49 |
-
st.write("Insert the values for the lists:")
|
50 |
|
51 |
# Solicitar al usuario que ingrese los valores de las listas
|
52 |
lista1 = [st.number_input(f"List 1 - Value {i+1}", value=0.0) for i in range(10)]
|
|
|
3 |
import matplotlib.pyplot as plt
|
4 |
|
5 |
def analizar_inversiones(lista1, lista2):
|
6 |
+
array1 = np.array(lista1)
|
7 |
+
array2 = np.array(lista2)
|
8 |
+
|
9 |
+
std_dev1 = np.std(array1)
|
10 |
+
std_dev2 = np.std(array2)
|
11 |
+
|
12 |
+
mean1 = np.mean(array1)
|
13 |
+
mean2 = np.mean(array2)
|
14 |
+
|
15 |
+
correlation = np.corrcoef(array1, array2)[0, 1]
|
16 |
+
|
17 |
+
fig, ax = plt.subplots()
|
18 |
+
ax.scatter(array1, array2)
|
19 |
+
ax.set_xlabel('Lista 1')
|
20 |
+
ax.set_ylabel('Lista 2')
|
21 |
+
ax.set_title('Investment graph')
|
22 |
+
ax.grid(True)
|
23 |
+
st.pyplot(fig)
|
|
|
|
|
|
|
|
|
24 |
|
25 |
# Decidir a cuál invertir más y a cuál menos
|
26 |
+
if mean1 > mean2:
|
27 |
+
invertir_mas = "List 1"
|
28 |
+
invertir_menos = "List 2"
|
29 |
+
else:
|
30 |
+
invertir_mas = "List 2"
|
31 |
+
invertir_menos = "List 1"
|
32 |
+
|
33 |
+
st.write("Results of the Analisis:")
|
34 |
+
st.write(f"Standar desviation of list 1: {std_dev1}")
|
35 |
+
st.write(f"Standar desviation of list 2: {std_dev2}")
|
36 |
+
st.write(f"Estimated value list 1: {mean1}")
|
37 |
+
st.write(f"Estimated value list 2: {mean2}")
|
38 |
+
st.write(f"Correlation: {correlation}")
|
39 |
+
st.write(f"Invest more in: {invertir_mas}")
|
40 |
+
st.write(f"Invest less in: {invertir_menos}")
|
|
|
41 |
|
42 |
def main():
|
43 |
+
st.title("Variance Portfolio")
|
44 |
+
st.write("Insert the values for the lists:")
|
45 |
|
46 |
# Solicitar al usuario que ingrese los valores de las listas
|
47 |
lista1 = [st.number_input(f"List 1 - Value {i+1}", value=0.0) for i in range(10)]
|