Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
a2fbaf9
1
Parent(s):
0fffee9
Update app.py
Browse files
app.py
CHANGED
@@ -46,10 +46,6 @@ 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 |
-
# Display the filtered DataFrame
|
50 |
-
st.write('Filtered DataFrame:')
|
51 |
-
st.write(filtered_df)
|
52 |
-
|
53 |
#Display the Forecasts values
|
54 |
if not filtered_df.empty:
|
55 |
data_string = filtered_df['Forecasts'].iloc[0]
|
@@ -65,3 +61,29 @@ if not filtered_df.empty:
|
|
65 |
st.write(f"Período {period}: {monetary_value}")
|
66 |
else:
|
67 |
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 |
#Display the Forecasts values
|
50 |
if not filtered_df.empty:
|
51 |
data_string = filtered_df['Forecasts'].iloc[0]
|
|
|
61 |
st.write(f"Período {period}: {monetary_value}")
|
62 |
else:
|
63 |
st.warning('No data available for the selected filters.')
|
64 |
+
|
65 |
+
# Display the Forecasts values as line plots
|
66 |
+
if not filtered_df.empty:
|
67 |
+
st.subheader('Forecasts Line Plots')
|
68 |
+
|
69 |
+
# Create a list to store data for each period
|
70 |
+
data = []
|
71 |
+
|
72 |
+
# Split the string into lines
|
73 |
+
lines = data_string.split('\n')
|
74 |
+
|
75 |
+
# Iterate through the lines and extract the values
|
76 |
+
for line in lines[:-2]:
|
77 |
+
period, value = line.split()
|
78 |
+
num_float = float(value)
|
79 |
+
monetary_value = f'R$ {num_float:,.2f}' # Adding commas for thousands separator
|
80 |
+
data.append({'Period': period, 'Monetary Value': num_float})
|
81 |
+
|
82 |
+
# Create a DataFrame from the list
|
83 |
+
chart_data = pd.DataFrame(data)
|
84 |
+
|
85 |
+
# Display line chart with "period" on X-axis and "Monetary Value" on Y-axis
|
86 |
+
st.line_chart(chart_data.set_index('Period'))
|
87 |
+
|
88 |
+
else:
|
89 |
+
st.warning('No data available for the selected filters.')
|