Home > Net >  How to extract months between two dates?
How to extract months between two dates?

Time:04-14

(using python) I want to extract months between two dates and make them into another list or dataframe. Dates are in different columns, named 'start date' and 'enddate'.

I've tried the following.

df3.apply(lambda x: pd.date_range(x.df3['startdate'],x.df3['enddate'], freq='MS').strftime("%Y%m"))


columns'startdate' looks like 2010-12-31, 
columns 'enddate' looks like 2011-04-12,

I want somethings like this:

2010-12
2011-01
2011-02
2011-03
2011-04

Can you help me with this problem?

  • Related