df.assign(
Months=
(df.Date2.dt.year - df.Date1.dt.year) * 12 +
(df.Date2.dt.month - df.Date1.dt.month)
)
Date1 Date2 Months
0 2016-04-07 2017-02-01 10
1 2017-02-01 2017-03-05 1
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter