0

I have a dataframe with multiple dates, such as '2019-05-01' and I want to substract it to get e.g. 4 (2019-09-01 - 2019-05-01). Those are two columns.

Henry Ecker
  • 31,792
  • 14
  • 29
  • 50
Adam_Gie
  • 11
  • 3

1 Answers1

0
df['delta'] = [ (x.year -  y.year) * 12 + (x.month -  y.month) for x, y in zip(df['date1'],df['date2'])]
ZygD
  • 10,844
  • 36
  • 65
  • 84
Adam_Gie
  • 11
  • 3