import pandas as pd

beginDate = '2018-08-01'
endDate = '2019-03-31'


date_index = pd.date_range(beginDate, endDate)
days = [pd.Timestamp(x).strftime("%Y-%m-%d") for x in date_index.values]

tmp = []
for index , v in enumerate(days):
    if index == len(days)-1:
        tmp.append(days[index])
    if index == 0:
        tmp.append(days[0])
    else:
        _ = v.split('-')[2]
        if _ == '01':
            tmp.append(days[index-1])
            tmp.append(days[index])

print(tmp)
for i in range(len(tmp)//2):
    print(tmp[i * 2] , tmp[i * 2 + 1])

原文链接:https://blog.csdn.net/dangsh_/article/details/100579144

相关文章:

  • 2020-05-15
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-06
  • 2022-02-13
  • 2022-12-23
  • 2021-10-01
  • 2021-07-16
  • 2021-08-26
  • 2022-12-23
相关资源
相似解决方案