Spaces:
Running
Running
Commit
•
0d64126
1
Parent(s):
3a1ee0e
Update app.py
Browse files
app.py
CHANGED
@@ -193,14 +193,9 @@ if not filtered_df.empty:
|
|
193 |
table_data = pd.merge(table_data, last_df)
|
194 |
|
195 |
try:
|
196 |
-
# Removing 'R$ ' and commas from the monetary columns for conversion to float
|
197 |
-
# Use regex=True in replace() method to ensure all instances are replaced
|
198 |
-
table_data['Próximos 12 meses'] = table_data['Próximos 12 meses'].replace(r'R\$ ', '', regex=True).replace(',', '', regex=True).astype(float)
|
199 |
-
table_data['Últimos 12 meses'] = table_data['Últimos 12 meses'].replace(r'R\$ ', '', regex=True).replace(',', '', regex=True).astype(float)
|
200 |
-
|
201 |
# Calculate the grand total sum of 'Próximos 12 meses' and 'Últimos 12 meses' values
|
202 |
-
total_sum =
|
203 |
-
total_sum_prev =
|
204 |
|
205 |
# Append the "Total" row
|
206 |
total_row = pd.DataFrame({
|
|
|
193 |
table_data = pd.merge(table_data, last_df)
|
194 |
|
195 |
try:
|
|
|
|
|
|
|
|
|
|
|
196 |
# Calculate the grand total sum of 'Próximos 12 meses' and 'Últimos 12 meses' values
|
197 |
+
total_sum = sum(float(row['Próximos 12 meses'].replace('R$ ', '').replace(',', '')) for row in data)
|
198 |
+
total_sum_prev = sum(float(row['Últimos 12 meses'].replace('R$ ', '').replace(',', '')) for row in data)
|
199 |
|
200 |
# Append the "Total" row
|
201 |
total_row = pd.DataFrame({
|