fschwartzer commited on
Commit
b36d1b3
1 Parent(s): 37d6b8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -53,7 +53,29 @@ with st.sidebar:
53
  selected_conta = st.selectbox('Seleciona Conta', df['Conta'].unique())
54
 
55
  # Filter the DataFrame based on selected values
56
- filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  #col1, col2, col3 = st.columns(3) # This divides the page into three equal parts
59
 
 
53
  selected_conta = st.selectbox('Seleciona Conta', df['Conta'].unique())
54
 
55
  # Filter the DataFrame based on selected values
56
+ #filtered_df = df[(df['Instituição'] == selected_instituicao) & (df['Conta'] == selected_conta)]
57
+
58
+ # Initial filtering based on selected 'Instituição'
59
+ instituicao_df = df[df['Instituição'] == selected_instituicao]
60
+
61
+ # Container for adjusted DataFrame rows
62
+ adjusted_rows = []
63
+
64
+ # Iterate through each unique 'Conta' within the selected 'Instituição'
65
+ for conta in instituicao_df['Conta'].unique():
66
+ conta_df = instituicao_df[instituicao_df['Conta'] == conta]
67
+
68
+ # Check if 'Linear Regression' is available for this 'Conta'
69
+ if 'Linear Regression' in conta_df['Modelo'].values:
70
+ # If yes, filter to only 'Linear Regression' results for this 'Conta'
71
+ lr_rows = conta_df[conta_df['Modelo'] == 'Linear Regression']
72
+ adjusted_rows.append(lr_rows)
73
+ else:
74
+ # If not, include all models' results for this 'Conta'
75
+ adjusted_rows.append(conta_df)
76
+
77
+ # Combine all adjusted rows back into a single DataFrame
78
+ filtered_df = pd.concat(adjusted_rows)
79
 
80
  #col1, col2, col3 = st.columns(3) # This divides the page into three equal parts
81