albhu commited on
Commit
635a76a
·
verified ·
1 Parent(s): 768d54f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -108,6 +108,7 @@ def calculate_late_interest(data, late_interest_rate, boe_rates_df):
108
 
109
  return data
110
 
 
111
  def analyze_excel(df):
112
  # Extract due dates and payment dates
113
  due_dates = df.iloc[:, 0].dropna().tolist()
@@ -145,10 +146,8 @@ def download_boe_rates():
145
 
146
  # Function to get Bank of England base rate for a given date
147
  def get_boe_base_rate(date, boe_rates_df):
148
- date = pd.to_datetime(date) # A date konvertálása dátum formátumra
149
- closest_date_index = (boe_rates_df['Date Changed'] - date).abs().argsort()[0]
150
- closest_date = boe_rates_df['Date Changed'].iloc[closest_date_index]
151
- return boe_rates_df.loc[closest_date_index, 'Current Bank Rate']
152
 
153
  if __name__ == "__main__":
154
  main()
 
108
 
109
  return data
110
 
111
+ # Function to analyze Excel sheet and extract relevant information
112
  def analyze_excel(df):
113
  # Extract due dates and payment dates
114
  due_dates = df.iloc[:, 0].dropna().tolist()
 
146
 
147
  # Function to get Bank of England base rate for a given date
148
  def get_boe_base_rate(date, boe_rates_df):
149
+ closest_date = boe_rates_df['Date Changed'].iloc[(boe_rates_df['Date Changed'] - date).abs().argsort()[0]]
150
+ return boe_rates_df.loc[boe_rates_df['Date Changed'] == closest_date, 'Current Bank Rate'].values[0]
 
 
151
 
152
  if __name__ == "__main__":
153
  main()