Let\'s say I have a dataframe with two columns that contain dates, and I want to create a new columns whose value is the number of months between those dates.
I'm not sure how to do it in python but the steps I would do:
see this link: http://pandas.pydata.org/pandas-docs/dev/timeseries.html#time-deltas
(df['Date2']-df['Date1']).apply(lambda x: x/np.timedelta64(1,'M'))
for numpy >=1.7 (see the link if you are using 1.6.1)
I am not sure what it will do with the fraction. (usually I would divide by np.timedelta64(1,'D')
then divide by say 30 to make a fractional num of months (as a float)