Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
55e2682
1
Parent(s):
5563ebe
Update app.py
Browse files
app.py
CHANGED
@@ -162,25 +162,25 @@ with tab1:
|
|
162 |
|
163 |
with tab2:
|
164 |
|
165 |
-
col1, col2= st.columns(2)
|
166 |
|
167 |
-
if not filtered_df.empty:
|
168 |
-
data_string = filtered_df['Forecasts'].iloc[0]
|
169 |
|
170 |
# Split the string into lines
|
171 |
-
lines = data_string.split('\n')
|
172 |
|
173 |
-
mes = 0
|
174 |
|
175 |
# Iterate through the lines and extract the values
|
176 |
-
for line in lines[:-1]: # Skip the last two lines which might not contain forecast data
|
177 |
-
period, value = line.split()
|
178 |
-
num_float = float(value)
|
179 |
-
monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
|
180 |
-
mes += 1
|
181 |
-
col1.write(f"Mês {mes}: {monetary_value}")
|
182 |
-
else:
|
183 |
-
col1.warning('No data available for the selected filters.')
|
184 |
|
185 |
# Display the Forecasts values as line plots in the second column
|
186 |
|
@@ -201,21 +201,21 @@ with tab2:
|
|
201 |
num_float = float(value)
|
202 |
monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
|
203 |
mes += 1
|
204 |
-
data.append({'
|
205 |
|
206 |
# Create a DataFrame from the list
|
207 |
chart_data = pd.DataFrame(data)
|
208 |
|
209 |
-
# Sort the DataFrame by '
|
210 |
-
chart_data = chart_data.sort_values(by='
|
211 |
|
212 |
# Display line chart with "period" on X-axis and "Monetary Value" on Y-axis
|
213 |
#col2.line_chart(chart_data.set_index('Period'))
|
214 |
-
fig = px.line(chart_data, x="
|
215 |
#st.plotly_chart(fig, theme=None, use_container_width=True)
|
216 |
st.plotly_chart(fig, theme=None)
|
217 |
else:
|
218 |
-
|
219 |
|
220 |
|
221 |
with tab3:
|
@@ -307,7 +307,7 @@ with tab3:
|
|
307 |
st.error(f"Error in processing data: {str(e)}")
|
308 |
|
309 |
else:
|
310 |
-
st.warning('
|
311 |
|
312 |
st.markdown("""
|
313 |
<b>Observação:</b> Previsões realizadas com dados extraídos do Relatório Resumido de Execução Orçamentária (RREO) até o 6º bimestre de 2023 no Sistema de Informações Contábeis e Fiscais do Setor Público Brasileiro (SICONFI).
|
|
|
162 |
|
163 |
with tab2:
|
164 |
|
165 |
+
#col1, col2= st.columns(2)
|
166 |
|
167 |
+
#if not filtered_df.empty:
|
168 |
+
#data_string = filtered_df['Forecasts'].iloc[0]
|
169 |
|
170 |
# Split the string into lines
|
171 |
+
#lines = data_string.split('\n')
|
172 |
|
173 |
+
#mes = 0
|
174 |
|
175 |
# Iterate through the lines and extract the values
|
176 |
+
#for line in lines[:-1]: # Skip the last two lines which might not contain forecast data
|
177 |
+
#period, value = line.split()
|
178 |
+
#num_float = float(value)
|
179 |
+
#monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
|
180 |
+
#mes += 1
|
181 |
+
#col1.write(f"Mês {mes}: {monetary_value}")
|
182 |
+
#else:
|
183 |
+
#col1.warning('No data available for the selected filters.')
|
184 |
|
185 |
# Display the Forecasts values as line plots in the second column
|
186 |
|
|
|
201 |
num_float = float(value)
|
202 |
monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
|
203 |
mes += 1
|
204 |
+
data.append({'Período': int(mes), 'Valores Previstos': num_float})
|
205 |
|
206 |
# Create a DataFrame from the list
|
207 |
chart_data = pd.DataFrame(data)
|
208 |
|
209 |
+
# Sort the DataFrame by 'Período'
|
210 |
+
chart_data = chart_data.sort_values(by='Período')
|
211 |
|
212 |
# Display line chart with "period" on X-axis and "Monetary Value" on Y-axis
|
213 |
#col2.line_chart(chart_data.set_index('Period'))
|
214 |
+
fig = px.line(chart_data, x="Período", y="Valores Previstos")
|
215 |
#st.plotly_chart(fig, theme=None, use_container_width=True)
|
216 |
st.plotly_chart(fig, theme=None)
|
217 |
else:
|
218 |
+
st.warning('Sem dados para os filtros selecionados.')
|
219 |
|
220 |
|
221 |
with tab3:
|
|
|
307 |
st.error(f"Error in processing data: {str(e)}")
|
308 |
|
309 |
else:
|
310 |
+
st.warning('Sem dados para os filtros selecionados.')
|
311 |
|
312 |
st.markdown("""
|
313 |
<b>Observação:</b> Previsões realizadas com dados extraídos do Relatório Resumido de Execução Orçamentária (RREO) até o 6º bimestre de 2023 no Sistema de Informações Contábeis e Fiscais do Setor Público Brasileiro (SICONFI).
|