datetime: How to get diff between 2 dates in month units?

P

python

Hi-


I have a lot of monthly time series data. I need to be able to compare
two dates and get the number of months that they are apart.

The datetime module is a daily-frequency data type. It has a timedelta
object that returns the difference in days between two dates:
31

I want to be able to compare monthly-frequency data, so that I can do
something like this:
6

Does anyone have any suggestions about how to do something like this?

Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top