File size: 1,268 Bytes
4b68381
 
cc74fad
4b68381
 
 
 
 
 
 
 
 
 
 
9c3f58c
 
 
 
 
 
 
 
 
 
 
 
 
4b68381
 
 
9c3f58c
 
4b68381
 
9c3f58c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import streamlit as st
import pandas as pd
import re

# Load your dataset
# Replace 'your_dataset.csv' with the actual path to your dataset
data = pd.read_csv('results.csv')

st.title('Previsões de Receitas')

# Add filters for 'Instituição' and 'Conta'
selected_instituicao = st.selectbox('Selecionar Instituição', data['Instituição'].unique())
selected_conta = st.selectbox('Selecionar Conta', data['Conta'].unique())

# Function to extract and format numbers as monetary values
def extract_and_format_numbers(input_string):
    # Extract numbers in scientific notation or standard decimal notation
    numbers = re.findall(r'\d+\.\d+e\+\d+|\d+\.\d+', input_string)
    
    # Format and print each number as a monetary value
    for num in numbers:
        # Convert the string to a float
        num_float = float(num)
        # Format as a monetary value (assuming Brazilian Real currency)
        monetary_value = f'R$ {num_float:.2f}'
        print(monetary_value)
        
# Filter the data based on user selections
filtered_data = data[(data['Instituição'] == selected_instituicao) & (data['Conta'] == selected_conta)]



# Display the 'Forecast' column values
st.write("Previsões:")
st.write(extract_and_format_numbers(filtered_data['Forecasts']))