使用python代码定义日期范围时遇到问题。 如何生成每月日期范围,例如' 2000-01-01',' 2000-02-01',....' 2011-12-01&#39 ;使用python代码。
if let colorArray = myObject.colorArray {
print("Color array: \(colorArray)")
colorArray.forEach { (entry) in
print("Array entry: \(entry)")
}
}
获得输出:
dates = pd.date_range(start='2000-01-01', end='2001-12-01',freq='M')
但我想要输出
DatetimeIndex(['2000-01-31', '2000-02-29', '2000-03-31', '2000-04-30',
'2000-05-31', '2000-06-30', '2000-07-31', '2000-08-31',
'2000-09-30', '2000-10-31', '2000-11-30', '2000-12-31',
'2001-01-31', '2001-02-28', '2001-03-31', '2001-04-30',
'2001-05-31', '2001-06-30', '2001-07-31', '2001-08-31',
'2001-09-30', '2001-10-31', '2001-11-30'],
dtype='datetime64[ns]', freq='M')