Как уточняется вами в одном из ваших комментариев.Создание MVE
from datetime import datetime
from dateutil.relativedelta import relativedelta
import random
a=np.array([datetime.now()-relativedelta(months=random.randint(0,100)) for i in range(10)])
print(a)
Вывод:
array([datetime.datetime(2014, 10, 12, 9, 0, 31, 696000),
datetime.datetime(2018, 9, 12, 9, 0, 31, 696000),
datetime.datetime(2014, 4, 12, 9, 0, 31, 696000),
datetime.datetime(2011, 4, 12, 9, 0, 31, 696000),
datetime.datetime(2015, 10, 12, 9, 0, 31, 696000),
datetime.datetime(2011, 11, 12, 9, 0, 31, 696000),
datetime.datetime(2016, 3, 12, 9, 0, 31, 696000),
datetime.datetime(2017, 10, 12, 9, 0, 31, 696000),
datetime.datetime(2010, 6, 12, 9, 0, 31, 696000),
datetime.datetime(2016, 2, 12, 9, 0, 31, 696000)], dtype=object)
tn Я предполагаю последний индекс массива.Поэтому
result=a[len(a)-1]-a
[datetime.timedelta(488),
datetime.timedelta(-943),
datetime.timedelta(671),
datetime.timedelta(1767),
datetime.timedelta(123),
datetime.timedelta(1553),
datetime.timedelta(-29),
datetime.timedelta(-608),
datetime.timedelta(2071),
datetime.timedelta(0)]