Spaces:
Sleeping
Sleeping
Commit
•
6e99dec
1
Parent(s):
6182642
Update app.py
Browse files
app.py
CHANGED
@@ -149,7 +149,7 @@ if not filtered_df.empty:
|
|
149 |
monetary_value = f'R$ {conta_sum:,.2f}'
|
150 |
|
151 |
# Append the data to the list
|
152 |
-
data.append({'Conta': conta, 'Modelo': modelo, '
|
153 |
|
154 |
# Convert the list to a DataFrame
|
155 |
table_data = pd.DataFrame(data)
|
@@ -162,17 +162,17 @@ if not filtered_df.empty:
|
|
162 |
table_data = pd.merge(table_data, last_df)
|
163 |
|
164 |
# Calculate the grand total sum of all 'Conta' values
|
165 |
-
total_sum = sum(float(row['
|
166 |
|
167 |
# Append the "Total" row
|
168 |
-
total_row = pd.DataFrame({'Conta': ['TOTAL (RLIT)'], 'Modelo': [''], '
|
169 |
table_data = pd.concat([table_data, total_row], ignore_index=True)
|
170 |
|
171 |
# Calculate and append the rows for "Saúde (12% da RLIT)" and "Educação (25% da RLIT)"
|
172 |
saude_value = total_sum * 0.15
|
173 |
educacao_value = total_sum * 0.25
|
174 |
-
saude_row = pd.DataFrame({'Conta': ['Saúde (15% da RLIT)'], 'Modelo': [''], '
|
175 |
-
educacao_row = pd.DataFrame({'Conta': ['Educação (25% da RLIT)'], 'Modelo': [''], '
|
176 |
|
177 |
# Append these rows to the table data
|
178 |
table_data = pd.concat([table_data, saude_row, educacao_row], ignore_index=True)
|
|
|
149 |
monetary_value = f'R$ {conta_sum:,.2f}'
|
150 |
|
151 |
# Append the data to the list
|
152 |
+
data.append({'Conta': conta, 'Modelo': modelo, 'Próximos 12 meses': monetary_value})
|
153 |
|
154 |
# Convert the list to a DataFrame
|
155 |
table_data = pd.DataFrame(data)
|
|
|
162 |
table_data = pd.merge(table_data, last_df)
|
163 |
|
164 |
# Calculate the grand total sum of all 'Conta' values
|
165 |
+
total_sum = sum(float(row['Próximos 12 meses'].replace('R$ ', '').replace(',', '')) for row in data)
|
166 |
|
167 |
# Append the "Total" row
|
168 |
+
total_row = pd.DataFrame({'Conta': ['TOTAL (RLIT)'], 'Modelo': [''], 'Próximos 12 meses': [f'R$ {total_sum:,.2f}']})
|
169 |
table_data = pd.concat([table_data, total_row], ignore_index=True)
|
170 |
|
171 |
# Calculate and append the rows for "Saúde (12% da RLIT)" and "Educação (25% da RLIT)"
|
172 |
saude_value = total_sum * 0.15
|
173 |
educacao_value = total_sum * 0.25
|
174 |
+
saude_row = pd.DataFrame({'Conta': ['Saúde (15% da RLIT)'], 'Modelo': [''], 'Próximos 12 meses': [f'R$ {saude_value:,.2f}']})
|
175 |
+
educacao_row = pd.DataFrame({'Conta': ['Educação (25% da RLIT)'], 'Modelo': [''], 'Próximos 12 meses': [f'R$ {educacao_value:,.2f}']})
|
176 |
|
177 |
# Append these rows to the table data
|
178 |
table_data = pd.concat([table_data, saude_row, educacao_row], ignore_index=True)
|