Spaces:
Running
Running
fschwartzer
commited on
Commit
•
90fcc66
1
Parent(s):
08348fb
Update app.py
Browse files
app.py
CHANGED
@@ -120,31 +120,11 @@ ultimo_ano = last_rows[['Instituição', 'Conta', 'Últimos 12 meses']]
|
|
120 |
print(ultimo_ano)
|
121 |
|
122 |
with tab1:
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
for _, row in conta_df.iterrows():
|
129 |
-
lines = row['Forecasts'].split('\n')
|
130 |
-
for line in lines[:-1]: # Skip the summary line
|
131 |
-
if line.strip():
|
132 |
-
parts = line.split()
|
133 |
-
value = parts[-1]
|
134 |
-
try:
|
135 |
-
conta_sum += float(value)
|
136 |
-
except ValueError:
|
137 |
-
print(f"Skipping line unable to convert to float: {line}")
|
138 |
-
|
139 |
-
# Append the data to the list
|
140 |
-
data.append({'Conta': conta, 'Modelo': modelo, 'Próximos 12 meses': conta_sum})
|
141 |
-
|
142 |
-
# Convert the list to a DataFrame
|
143 |
-
table_data = pd.DataFrame(data)
|
144 |
-
total_sum = table_data['Próximos 12 meses'].sum()
|
145 |
-
|
146 |
-
labels = table_data['Conta']
|
147 |
-
sizes = [(i / total_sum) * 100 for i in table_data['Próximos 12 meses']]
|
148 |
|
149 |
#fig1, ax1 = plt.subplots()
|
150 |
#ax1.pie(sizes, labels=labels, autopct='%1.1f%%',)
|
|
|
120 |
print(ultimo_ano)
|
121 |
|
122 |
with tab1:
|
123 |
+
municipio = ultimo_ano[ultimo_ano['Instituição'] == selected_instituicao]
|
124 |
+
|
125 |
+
labels = municipio['Conta']
|
126 |
+
total_sum = municipio['Últimos 12 meses'].sum()
|
127 |
+
sizes = [(i / total_sum) * 100 for i in municipio['Últimos 12 meses']]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
#fig1, ax1 = plt.subplots()
|
130 |
#ax1.pie(sizes, labels=labels, autopct='%1.1f%%',)
|