Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.37 KB

File metadata and controls

54 lines (41 loc) · 1.37 KB

Python usage

No package install required — just read the JSON directly from GitHub or clone the repo.

import json
import urllib.request

BASE = "https://raw.githubusercontent.com/eu-data-commons/eu-holidays-data/main"

def holidays(country: str, year: int):
    url = f"{BASE}/data/{year}/{country}.json"
    with urllib.request.urlopen(url) as r:
        return json.loads(r.read())

de = holidays("germany", 2026)
print(f"{de['country']} {de['year']}: {len(de['holidays'])} holidays")
for h in de["holidays"]:
    print(f"  {h['date']}  {h['localizedNames']['de']} ({h['name']})")

Reading all countries from a clone

import json
from pathlib import Path

YEAR = 2026
data_dir = Path("data") / str(YEAR)

all_holidays = []
for path in sorted(data_dir.glob("*.json")):
    with path.open(encoding="utf-8") as f:
        country = json.load(f)
    for h in country["holidays"]:
        all_holidays.append({
            "country": country["country"],
            "iso": country["iso"],
            **h,
        })

print(f"{YEAR}: {len(all_holidays)} holidays across {len(list(data_dir.glob('*.json')))} countries")

pandas

import pandas as pd
df = pd.read_csv(f"{BASE}/csv/all-2026.csv")
print(df.head())
print(df.groupby("country")["date"].count().sort_values(ascending=False))

For interactive lookups see WorkDaten.eu.