Pandas1.0中的b日期偏移返回20200101作为工作日。高效地为美国创建定制商务舱?

2024-09-28 05:18:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我惊讶地看到,BDay将2020-01-01视为一个工作日

然后我知道我必须使用定制的工作日

enter image description here

有没有一种有效的方法?我对市场关闭期间的美国假日感兴趣

我的原始代码如下:

end_train = '2019-12-31'
end_train = pd.Timestamp(end_train)  # Converts the string to datetime
start_dev = end_train + BDay( 1)  # Looks forward 1 Business Day
start_dev = start_dev.strftime('%Y-%m-%d') # Converts the datetime to string

start_dev

'2020-01-01'

Tags: theto方法代码devdatetimestring市场

热门问题