Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
b654e25
1
Parent(s):
326e4b3
Update app.py
Browse files
app.py
CHANGED
@@ -46,15 +46,32 @@ with st.sidebar:
|
|
46 |
# Filter the DataFrame based on selected values
|
47 |
filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
if not filtered_df.empty:
|
51 |
-
st.subheader('
|
|
|
|
|
52 |
|
53 |
# Create a list to store data for each period
|
54 |
data = []
|
55 |
|
56 |
-
data_string = filtered_df['Forecasts'].iloc[0]
|
57 |
-
|
58 |
# Split the string into lines
|
59 |
lines = data_string.split('\n')
|
60 |
|
@@ -75,4 +92,4 @@ if not filtered_df.empty:
|
|
75 |
st.line_chart(chart_data.set_index('Period'))
|
76 |
|
77 |
else:
|
78 |
-
st.warning('No data available for the selected filters.')
|
|
|
46 |
# Filter the DataFrame based on selected values
|
47 |
filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
|
48 |
|
49 |
+
|
50 |
+
#Display the Forecasts values
|
51 |
+
if not filtered_df.empty:
|
52 |
+
data_string = filtered_df['Forecasts'].iloc[0]
|
53 |
+
|
54 |
+
# Split the string into lines
|
55 |
+
lines = data_string.split('\n')
|
56 |
+
|
57 |
+
# Iterate through the lines and extract the values
|
58 |
+
for line in lines[:-2]:
|
59 |
+
period, value = line.split()
|
60 |
+
num_float = float(value)
|
61 |
+
monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
|
62 |
+
st.write(f"Período {period}: {monetary_value}")
|
63 |
+
else:
|
64 |
+
st.warning('No data available for the selected filters.')
|
65 |
+
|
66 |
+
Display the Forecasts values as line plots
|
67 |
if not filtered_df.empty:
|
68 |
+
st.subheader('Forecasts Line Plots')
|
69 |
+
|
70 |
+
data_string = filtered_df['Forecasts'].iloc[0]
|
71 |
|
72 |
# Create a list to store data for each period
|
73 |
data = []
|
74 |
|
|
|
|
|
75 |
# Split the string into lines
|
76 |
lines = data_string.split('\n')
|
77 |
|
|
|
92 |
st.line_chart(chart_data.set_index('Period'))
|
93 |
|
94 |
else:
|
95 |
+
st.warning('No data available for the selected filters.')
|