Skip to content

Instantly share code, notes, and snippets.

@natyrix
Created October 23, 2022 18:31
Show Gist options
  • Save natyrix/1010a1b8156cd5dae5d3777fe358ba6d to your computer and use it in GitHub Desktop.
Save natyrix/1010a1b8156cd5dae5d3777fe358ba6d to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment