I want to generate a python list containing all months occurring between two dates, with the input and output formatted as follows:
date1 = \"2014-10-10\" #
With pandas, you can have a one liner like this:
import pandas as pd date1 = "2014-10-10" # input start date date2 = "2016-01-07" # input end date month_list = [i.strftime("%b-%y") for i in pd.date_range(start=date1, end=date2, freq='MS')]