Tratando de ser menos:
sdate = [2008, 8, 15]
edate = [2018, 9, 15]
calendario = [[n // 12 + 2008, 1 + n % 12, 15] for n in range(sdate[1] - 1, (edate[0] - sdate[0]) * 12 + edate[1] - 1)]
print(calendario)
No usa ninguna librería ni función.
El truco está en contar los meses a partir del mes inicial; en este caso, sería la secuencia:
n = 1, 2, 3, ...... , 120, 121
El valor de n
se calcula como el número de meses entre ambas fechas.
Cada valor de n
puede ser reconvertido a [año, mes, 15]
usando la formula:
ano = n // 12 + 2008
mes = 1 + n % 12
Teniendo la lista final de [ano, mes, dia]
, es posible convertirla fácilmente a cualquier otro tipo de objeto.
Demo
sdate = [2008, 8, 15]
edate = [2018, 9, 15]
calendario = [[n // 12 + 2008, 1 + n % 12, 15] for n in range(sdate[1] - 1, (edate[0] - sdate[0]) * 12 + edate[1] - 1)]
print(calendario)
produce:
[[2008, 8, 15], [2008, 9, 15], [2008, 10, 15], [2008, 11, 15], [2008, 12, 15], [2009, 1, 15], [2009, 2, 15], [2009, 3, 15], [2009, 4, 15], [2009, 5, 15], [2009, 6, 15], [2009, 7, 15], [2009, 8, 15], [2009, 9, 15], [2009, 10, 15], [2009, 11, 15], [2009, 12, 15], [2010, 1, 15], [2010, 2, 15], [2010, 3, 15], [2010, 4, 15], [2010, 5, 15], [2010, 6, 15], [2010, 7, 15], [2010, 8, 15], [2010, 9, 15], [2010, 10, 15], [2010, 11, 15], [2010, 12, 15], [2011, 1, 15], [2011, 2, 15], [2011, 3, 15], [2011, 4, 15], [2011, 5, 15], [2011, 6, 15], [2011, 7, 15], [2011, 8, 15], [2011, 9, 15], [2011, 10, 15], [2011, 11, 15], [2011, 12, 15], [2012, 1, 15], [2012, 2, 15], [2012, 3, 15], [2012, 4, 15], [2012, 5, 15], [2012, 6, 15], [2012, 7, 15], [2012, 8, 15], [2012, 9, 15], [2012, 10, 15], [2012, 11, 15], [2012, 12, 15], [2013, 1, 15], [2013, 2, 15], [2013, 3, 15], [2013, 4, 15], [2013, 5, 15], [2013, 6, 15], [2013, 7, 15], [2013, 8, 15], [2013, 9, 15], [2013, 10, 15], [2013, 11, 15], [2013, 12, 15], [2014, 1, 15], [2014, 2, 15], [2014, 3, 15], [2014, 4, 15], [2014, 5, 15], [2014, 6, 15], [2014, 7, 15], [2014, 8, 15], [2014, 9, 15], [2014, 10, 15], [2014, 11, 15], [2014, 12, 15], [2015, 1, 15], [2015, 2, 15], [2015, 3, 15], [2015, 4, 15], [2015, 5, 15], [2015, 6, 15], [2015, 7, 15], [2015, 8, 15], [2015, 9, 15], [2015, 10, 15], [2015, 11, 15], [2015, 12, 15], [2016, 1, 15], [2016, 2, 15], [2016, 3, 15], [2016, 4, 15], [2016, 5, 15], [2016, 6, 15], [2016, 7, 15], [2016, 8, 15], [2016, 9, 15], [2016, 10, 15], [2016, 11, 15], [2016, 12, 15], [2017, 1, 15], [2017, 2, 15], [2017, 3, 15], [2017, 4, 15], [2017, 5, 15], [2017, 6, 15], [2017, 7, 15], [2017, 8, 15], [2017, 9, 15], [2017, 10, 15], [2017, 11, 15], [2017, 12, 15], [2018, 1, 15], [2018, 2, 15], [2018, 3, 15], [2018, 4, 15], [2018, 5, 15], [2018, 6, 15], [2018, 7, 15], [2018, 8, 15]]
resample()
??, lo utilice en una respuesta a una de tus preguntas