Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
a8d856c
1
Parent(s):
f7f079d
Update app.py
Browse files
app.py
CHANGED
@@ -1,56 +1,23 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
-
import re
|
4 |
-
import matplotlib.pyplot as plt
|
5 |
|
6 |
-
|
7 |
-
data = pd.read_csv('results_v2.csv')
|
8 |
|
9 |
-
st.
|
|
|
|
|
|
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
selected_conta = st.selectbox('Selecionar Conta', data['Conta'].unique())
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
input_data = input_data.tolist()
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
for num in numbers:
|
28 |
-
# Convert the string to a float
|
29 |
-
num_float = float(num)
|
30 |
-
|
31 |
-
# Format as a monetary value (assuming Brazilian Real currency)
|
32 |
-
monetary_value = f'R$ {num_float:.2f}'
|
33 |
-
formatted_numbers.append(monetary_value)
|
34 |
-
|
35 |
-
return formatted_numbers
|
36 |
-
|
37 |
-
filtered_data = data[(data['Instituição'] == selected_instituicao)]
|
38 |
-
|
39 |
-
# Count of each unique 'Conta' value
|
40 |
-
conta_counts = filtered_data['Conta'].value_counts()
|
41 |
-
|
42 |
-
# Set up the layout with columns
|
43 |
-
col1, col2 = st.columns([2, 1])
|
44 |
-
|
45 |
-
with col1:
|
46 |
-
st.write("Previsões:")
|
47 |
-
table_data = data[(data['Instituição'] == selected_instituicao) & (data['Conta'] == selected_conta)]
|
48 |
-
formatted_forecasts = extract_and_format_numbers(table_data['Forecasts'])
|
49 |
-
st.write(formatted_forecasts)
|
50 |
-
|
51 |
-
with col2:
|
52 |
-
# Plotting a pie chart
|
53 |
-
fig, ax = plt.subplots()
|
54 |
-
ax.pie(conta_counts, labels=conta_counts.index, autopct='%1.1f%%')
|
55 |
-
ax.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
|
56 |
-
st.pyplot(fig) # Display the pie chart in Streamlit
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
|
|
|
|
3 |
|
4 |
+
df = pd.read_csv('last_results.csv')
|
|
|
5 |
|
6 |
+
with st.sidebar:
|
7 |
+
st.markdown('Previsões de Receitas')
|
8 |
+
selected_instituicao = st.selectbox('Select Instituição', df['Instituição'].unique())
|
9 |
+
selected_conta = st.selectbox('Select Conta', df['Conta'].unique())
|
10 |
|
11 |
+
# Filter the DataFrame based on selected values
|
12 |
+
filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
|
|
|
13 |
|
14 |
+
# Display the filtered DataFrame
|
15 |
+
st.write('Filtered DataFrame:')
|
16 |
+
st.write(filtered_df)
|
|
|
17 |
|
18 |
+
# Display the Forecasts values
|
19 |
+
if not filtered_df.empty:
|
20 |
+
forecasts_values = filtered_df['Forecasts'].values
|
21 |
+
st.write('Forecasts Values:', forecasts_values)
|
22 |
+
else:
|
23 |
+
st.warning('No data available for the selected filters.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|