How to include end date in pandas date_range method?
问题 From pd.date_range('2016-01', '2016-05', freq='M', ).strftime('%Y-%m') , the last month is 2016-04 , but I was expecting it to be 2016-05 . It seems to me this function is behaving like the range method, where the end parameter is not included in the returning array. Is there a way to get the end month included in the returning array, without processing the string for the end month? 回答1: A way to do it without messing with figuring out month ends yourself. pd.date_range(*(pd.to_datetime([