Skip to content

Instantly share code, notes, and snippets.

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

  • Save natyrix/36dab764077afd9b60eaa9d00f045d26 to your computer and use it in GitHub Desktop.

Select an option

Save natyrix/36dab764077afd9b60eaa9d00f045d26 to your computer and use it in GitHub Desktop.

Revisions

  1. natyrix created this gist Oct 23, 2022.
    8 changes: 8 additions & 0 deletions is_weekend.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    def isWeekend(self, df_date_str):
    # 2021-07-01 07:28:04
    datetime_object = datetime.strptime(df_date_str, '%Y-%m-%d %H:%M:%S')
    # print(datetime_object.weekday())
    if datetime_object.weekday() < 5:
    return 0
    else: # 5 Sat, 6 Sun
    return 1