Попытка создать новый столбец, который является суммой даты [Дата покупки] с другим столбцом, который содержит количество месяцев [Mainte3].
df['Purchase date'] = pd.to_datetime(df['Purchase date'], format='%m/%d/%Y').dt.strftime('%Y-%m-%d') #pass column to a date and then change format
df['New Date'] = df.apply(lambda x: x['Purchase date'] + pd.DateOffset(months = x['Mainte3']), axis=1)
df["Purchase date"].dtypes
object
df["Mainte3"].dtypes
float64
Таблица имеет следующий формат: таблицаsnip
Но я получаю сообщение об ошибке:
if any(x is not None and x != int(x) for x in (years, months)):
ValueError: ('cannot convert float NaN to integer', 'occurred at index 0')
Любая помощь приветствуется.Спасибо.