vacanza / holidays

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

Carnaval missing in Brazil after 0.25 #1780

Closed ds-mauri closed 5 months ago

ds-mauri commented 5 months ago

Hello!

Noticed that when I run hhols.country_holidays('BR', years=[2023], observed=True).items() after the version 0.25 it doesn't bring Carnaval (usually in february) for Brazil. Tried it with the most recent version 0.47.

Should I be calling the function differently?

Thanks!

KJhellico commented 5 months ago

Hello, @ds-mauri! Yes, since v0.33 optional holidays in Brazil have been placed in OPTIONAL category. So code should look like:

from holidays.constants import OPTIONAL, PUBLIC
from holidays.utils import country_holidays

# if you need all holidays
br = country_holidays("BR", years=2023, categories=(OPTIONAL, PUBLIC))

# or, if you need OPTIONAL holidays only
br_opt = country_holidays("BR", years=2023, categories=OPTIONAL)
ds-mauri commented 5 months ago

Amazing! Thanks for the explanation @KJhellico !