Python输入时间范围输出指定格式年月日
start_date, end_date = '2021-1-1', '2021-12-31'dtrange = pd.date_range(start=start_date, end=end_date, freq='d')months = pd.Series(dtrange .month)starts, ends = months.ne(months.shift(1)), months.ne(months.shift(-1))lastmon=months.ne(months.shift(2))