Python生成一段时间的日期数据及对应的星期几

import pandas as pd
date=pd.date_range('2010/1/1','2010/12/31', freq='D')
week=[int(i.strftime("%w")) for i in date]  # 0表示星期日
dataframe = pd.DataFrame({'date':date,'week':week})   
dataframe.to_excel('date000.xlsx',index=False)

猜你喜欢

转载自blog.csdn.net/zsc201825/article/details/81185550