Determine if a day is a business day in Python / Pandas

后端 未结 6 1703
深忆病人
深忆病人 2021-02-13 23:06

I currently have a program setup to run two different ways. One way is to run over a specified time frame, and the other way is to run everyday. However, when I have it set to r

6条回答
  •  忘掉有多难
    2021-02-13 23:43

    Using at least numpy version 1.7.0., try np.is_busday()

    start = datetime.date.today().strftime("%Y-%m-%d")
    end = datetime.date.today().strftime("%Y-%m-%d")
    
    if start == end:
    
        # added code here
        if not np.is_busday(start):
            print("Not a Business day")
    

提交回复
热议问题