fschwartzer commited on
Commit
ad5d544
1 Parent(s): 1ad2afa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -46,8 +46,12 @@ 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
- #Display the Forecasts values
51
  if not filtered_df.empty:
52
  data_string = filtered_df['Forecasts'].iloc[0]
53
 
@@ -59,14 +63,14 @@ if not filtered_df.empty:
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
@@ -89,7 +93,7 @@ if not filtered_df.empty:
89
  chart_data = chart_data.sort_values(by='Period')
90
 
91
  # Display line chart with "period" on X-axis and "Monetary Value" on Y-axis
92
- st.line_chart(chart_data.set_index('Period'))
93
 
94
  else:
95
- 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
+ # Create two columns
50
+ col1, col2 = st.columns(2)
51
+
52
+ # Display the Forecasts values in the first column
53
+ col1.header('Forecasts Values')
54
 
 
55
  if not filtered_df.empty:
56
  data_string = filtered_df['Forecasts'].iloc[0]
57
 
 
63
  period, value = line.split()
64
  num_float = float(value)
65
  monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
66
+ col1.write(f"Período {period}: {monetary_value}")
67
  else:
68
+ col1.warning('No data available for the selected filters.')
69
 
70
+ # Display the Forecasts values as line plots in the second column
71
+ col2.header('Forecasts Line Plots')
 
72
 
73
+ if not filtered_df.empty:
74
  data_string = filtered_df['Forecasts'].iloc[0]
75
 
76
  # Create a list to store data for each period
 
93
  chart_data = chart_data.sort_values(by='Period')
94
 
95
  # Display line chart with "period" on X-axis and "Monetary Value" on Y-axis
96
+ col2.line_chart(chart_data.set_index('Period'))
97
 
98
  else:
99
+ col2.warning('No data available for the selected filters.')