Update app.py
Browse files
app.py
CHANGED
@@ -144,10 +144,10 @@ def download_boe_rates():
|
|
144 |
st.error(f"Failed to download rates: {e}")
|
145 |
return None
|
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 |
-
|
150 |
-
|
|
|
151 |
|
152 |
if __name__ == "__main__":
|
153 |
main()
|
|
|
144 |
st.error(f"Failed to download rates: {e}")
|
145 |
return None
|
146 |
|
|
|
147 |
def get_boe_base_rate(date, boe_rates_df):
|
148 |
+
closest_date_index = (boe_rates_df['Date Changed'] - pd.Timestamp(date)).abs().argsort()[0]
|
149 |
+
closest_date = boe_rates_df['Date Changed'].iloc[closest_date_index]
|
150 |
+
return boe_rates_df.loc[closest_date_index, 'Current Bank Rate']
|
151 |
|
152 |
if __name__ == "__main__":
|
153 |
main()
|