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.
>dfIndex Date1 Date21 2012/03/07 2013/03/162 2012/12/05 2012/12/253 2010/06/30 2013/05/194 2002/11/02 2011.06.08df["Date1"]= pd.to_datetime(df["Date1"])df["Date2"]= pd.to_datetime(df["Date2"])
Date1 will always be before date2. My current method of doing this requires about 10 steps, and I'm pretty sure there's an easier way to do this. Thoughts?