I have a piece of code doing those calculations :
import numpy as np
import pandas as pd
a = pd.Timestamp(2022, 1, 1)
b = pd.Timestamp(2022, 7, 1)
x = (b - a) / np.timedelta64(1, "M") # duration in months
y = (b - a) / np.timedelta64(1, "Y") # duration in years
x and y values are 5.9467... and 0.4955..., which is correct (almost 6 months and a half year).
Can someone know by which float number the division is done ?
For example, for months, it could be dividing by 365/12, but it is not the case.