Skip to content

Instantly share code, notes, and snippets.

@natyrix
Created October 23, 2022 18:31
Show Gist options
  • Select an option

  • Save natyrix/1010a1b8156cd5dae5d3777fe358ba6d to your computer and use it in GitHub Desktop.

Select an option

Save natyrix/1010a1b8156cd5dae5d3777fe358ba6d to your computer and use it in GitHub Desktop.

Revisions

  1. natyrix created this gist Oct 23, 2022.
    15 changes: 15 additions & 0 deletions is_holiday.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    import holidays

    class EDAPipeline():

    def __init__(self) -> None:
    self.ng_holidays = holidays.country_holidays('NG')

    def isHoliday(self, df_date_str):
    try:
    dt = datetime.strptime(df_date_str, '%Y-%m-%d %H:%M:%S').date()
    if dt in self.ng_holidays:
    return 1
    else: return 0
    except Exception as e:
    return 0