0

I'd like to create a list of months from a specific starting point up to an ending point. For example:

startDate = '2013-10'
endDate = '2014-02'

listofMonths = [SOME LIST COMPREHENSION FUNCTION]

print listofMonths

> ['2013-10', '2013-11', '2013-12','2014-01','2014-02']

I'm struggling to figure out how to make the date part of this work (since it needs to reset at 12). Ideally, the list will be strings, as it's going to be the columns for a Pandas DataFrame. Any suggestions would be appreciated!

Tim
  • 41,901
  • 18
  • 127
  • 145
flyingmeatball
  • 7,457
  • 7
  • 44
  • 62

0 Answers0