vacanza / python-holidays

Generate and work with holidays in Python
https://pypi.org/project/holidays
MIT License
1.44k stars 459 forks source link

Barcelona Local Holidays to be added in Spain (ES) holiday package #1710

Open SimgeChetin opened 7 months ago

SimgeChetin commented 7 months ago

Hello, Our company is based in Barcelona and we utilize Barcelona Local Holidays as public holidays in our calculations. Could you include Barcelona Local Holidays as linked here, in the holidays package? For example May 20 and September 24 is missing from Spain (ES) holidays package. Maybe it could be added under regional category. Thank you.

The code example

from datetime import datetime, timedelta, time
import holidays
import calendar
import pandas as pd

per1 = pd.date_range(start="2024-01-01", end="2024-12-31").tolist()

holiday_lists = {
    "ES": holidays.country_holidays("ES", subdiv="CT"),
}

def is_public_holiday(date, country):
    # Choose holiday list based on the country
    if country not in holiday_lists:
        return False
    return date in holiday_lists[country]

for val in per1:
    if is_public_holiday(val, "ES"):
        print(val, "ES", is_public_holiday(val, "ES"))

Image 1-3-24 at 16 39

arkid15r commented 7 months ago

Hi @SimgeChetin, thanks for requesting this. We don't treat the source you've referred to as an official one. I found this and this one that confirm the missing holidays.

Please add any official sources if you know any.

SimgeChetin commented 7 months ago

Hi @SimgeChetin, thanks for requesting this. We don't treat the source you've referred to as an official one. I found this and this one that confirm the missing holidays.

Please add any official sources if you know any.

Hello @arkid15r thanks for your quick response. I can confirm this one can be taken into consideration for the missing holidays. Also is it possible to add missing holidays for 2023 as well? Those would be June 5th 2023 and September 25th 2023. Thank you :)