fschwartzer commited on
Commit
c318f99
1 Parent(s): cfc693b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -3
app.py CHANGED
@@ -1,5 +1,11 @@
1
  import streamlit as st
2
  import pandas as pd
 
 
 
 
 
 
3
 
4
  df = pd.read_csv('last_results.csv')
5
 
@@ -38,8 +44,27 @@ st.markdown(
38
  with st.sidebar:
39
  st.image(image1, use_column_width=True)
40
  st.markdown(title_html, unsafe_allow_html=True)
41
- selected_instituicao = st.selectbox('Select Instituição', df['Instituição'].unique())
42
- selected_conta = st.selectbox('Select Conta', df['Conta'].unique())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  # Filter the DataFrame based on selected values
45
  filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
@@ -51,6 +76,20 @@ st.write(filtered_df)
51
  # Display the Forecasts values
52
  if not filtered_df.empty:
53
  forecasts_values = filtered_df['Forecasts'].values
54
- st.write('Forecasts Values:', forecasts_values)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  else:
56
  st.warning('No data available for the selected filters.')
 
1
  import streamlit as st
2
  import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import numpy as np
5
+ import locale
6
+
7
+ # Set the locale to Brazilian Portuguese
8
+ locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8')
9
 
10
  df = pd.read_csv('last_results.csv')
11
 
 
44
  with st.sidebar:
45
  st.image(image1, use_column_width=True)
46
  st.markdown(title_html, unsafe_allow_html=True)
47
+ selected_instituicao = st.selectbox('Seleciona Instituição', df['Instituição'].unique())
48
+ selected_conta = st.selectbox('Seleciona Conta', df['Conta'].unique())
49
+ # Generate some example data
50
+ x = np.linspace(0, 10, 100)
51
+ y1 = np.sin(x)
52
+ y2 = np.cos(x)
53
+ y3 = np.tan(x)
54
+
55
+ # Plot the lines using Matplotlib
56
+ fig, ax = plt.subplots()
57
+ ax.plot(x, y1, label='Green Line', color='green')
58
+ ax.plot(x, y2, label='Red Line', color='red')
59
+ ax.plot(x, y3, label='Yellow Line', color='yellow')
60
+
61
+ # Set plot properties
62
+ ax.legend()
63
+ ax.set_xlabel('X-axis')
64
+ ax.set_ylabel('Y-axis')
65
+
66
+ # Display the Matplotlib plot in the Streamlit sidebar
67
+ st.sidebar.pyplot(fig)
68
 
69
  # Filter the DataFrame based on selected values
70
  filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
 
76
  # Display the Forecasts values
77
  if not filtered_df.empty:
78
  forecasts_values = filtered_df['Forecasts'].values
79
+
80
+ data_string = forecasts_values
81
+
82
+ # Split the string into lines
83
+ lines = data_string.split('\n')
84
+
85
+ # Iterate through the lines and extract the values
86
+ for line in lines[:-2]: # Exclude the last two elements (empty and the 'Name: Valor, dtype: float64' line)
87
+ period, value = line.split()
88
+ num_float = float(value)
89
+
90
+ # Format as monetary value with dots and comma
91
+ monetary_value = locale.currency(num_float, grouping=True)
92
+
93
+ st.write(f"Período {period}: {monetary_value}")
94
  else:
95
  st.warning('No data available for the selected filters.')