KeyError Traceback (most recent call last)
Cell In[1], line 28
25 return target_date.strftime(“%Y年%m月%d日”)
27 # Predicting the date for 2027
—> 28 eid_al_adha_2027 = predict_eid_al_adha(2027)
29 eid_al_adha_2027
Cell In[1], line 17, in predict_eid_al_adha(year)
14 # Predicting the date for the target year
15 if year not in historical_dates:
16 # Calculate the average difference in days between consecutive years
—> 17 differences = [historical_dates[year] - historical_dates[year-1] for year in range(2023, 2025)]
18 avg_difference = sum(differences, timedelta()) / len(differences)
20 # Predict the date for the target year
Cell In[1], line 17, in <listcomp>(.0)
14 # Predicting the date for the target year
15 if year not in historical_dates:
16 # Calculate the average difference in days between consecutive years
—> 17 differences = [historical_dates[year] - historical_dates[year-1] for year in range(2023, 2025)]
18 avg_difference = sum(differences, timedelta()) / len(differences)
20 # Predict the date for the target year
KeyError: 2022