Cachoups commited on
Commit
c58f05f
·
verified ·
1 Parent(s): 161ab32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -182,7 +182,6 @@ def process_and_compare(file1, sheet1, file2, sheet2):
182
  historical_col = f'Historical {year - 1}'
183
  baseline_cols = [f'Baseline {year}', f'Baseline {year + 1}', f'Baseline {year + 2}']
184
  adverse_cols = [f'Adverse {year}', f'Adverse {year + 1}', f'Adverse {year + 2}']
185
- adverse_cols = [f'{year}', f'{year + 1}', f'{year + 2}']
186
  level_deviation_col = f'Level Deviation {year + 2}'
187
 
188
  # Drop rows and reset index
@@ -197,7 +196,6 @@ def process_and_compare(file1, sheet1, file2, sheet2):
197
  else:
198
  raise ValueError(f"Expected {len(new_columns)} columns, but found {len(df.columns)} columns in the data.")
199
  columns = ['Country', f'Adverse {year}', f'Adverse {year+1}', f'Adverse {year+2}', 'Adverse Cumulative']
200
- columns = ['Country', f'{year}', f'{year+1}', f'{year+2}', 'Cumulative']
201
  return df, df[columns]
202
 
203
  # Process both files
@@ -306,6 +304,7 @@ def generate_text(df, country, theme):
306
  formatted_row.append(f"{col}: {value}")
307
  return "\n".join(formatted_row)
308
  # Convert the row to a string format for prompt
 
309
  row = df[df['Country'] == country].iloc[0]
310
  row_str = format_row_for_prompt(row)
311
  #row_str = row.to_string(index=True)
 
182
  historical_col = f'Historical {year - 1}'
183
  baseline_cols = [f'Baseline {year}', f'Baseline {year + 1}', f'Baseline {year + 2}']
184
  adverse_cols = [f'Adverse {year}', f'Adverse {year + 1}', f'Adverse {year + 2}']
 
185
  level_deviation_col = f'Level Deviation {year + 2}'
186
 
187
  # Drop rows and reset index
 
196
  else:
197
  raise ValueError(f"Expected {len(new_columns)} columns, but found {len(df.columns)} columns in the data.")
198
  columns = ['Country', f'Adverse {year}', f'Adverse {year+1}', f'Adverse {year+2}', 'Adverse Cumulative']
 
199
  return df, df[columns]
200
 
201
  # Process both files
 
304
  formatted_row.append(f"{col}: {value}")
305
  return "\n".join(formatted_row)
306
  # Convert the row to a string format for prompt
307
+ df.columns = ['Country', f'{year}', f'{year+1}', f'{year+2}', 'Cumulative']
308
  row = df[df['Country'] == country].iloc[0]
309
  row_str = format_row_for_prompt(row)
310
  #row_str = row.to_string(index=True)