1

I have the following table:

date months to add
02-2022 2
05-2012 1

where the "date" column contains datetime objects, while "months to add" contains integers.
I want to obtain the following series of datetime objects:

new date
04-2022
06-2012

EDIT:
It turns out this question had already been partially answered here.
I simply replaced the call to progress_apply (which now throws "AttributeError: 'DataFrame' object has no attribute 'progress_apply') with a simple apply.

chattershuts
  • 366
  • 2
  • 10
  • For your purposes, what is "31-Jan-2022 + 1 month"? Is it truncated to the last day of the following month? – pilcrow Feb 22 '22 at 16:24
  • Thanks for fixing the formatting. I actually don't need the granularity of the day, so I edited my question – chattershuts Feb 22 '22 at 16:26
  • Almost! When I first searched for a solution I saw this answer but I didn't see the non-accepted solution. It is almost the correct answer because it uses the method progress_apply which with my version of Pandas throws "AttributeError: 'DataFrame' object has no attribute 'progress_apply'". I simply replaced with a normal "apply" and it works like a charm. – chattershuts Feb 22 '22 at 18:14
  • What should I do in this case? flag the question as a duplicate? It is not exactly a duplicate because in the other question the answer that came in handy to me is not the accepted one. – chattershuts Feb 22 '22 at 18:18
  • @chattershuts, good question. I'd edit the question to point explicitly to the non-accepted answer in the other question — so future searchers can benefit from your investigation — then close as a dup. – pilcrow Feb 22 '22 at 18:50
  • I don't think I have enough privileges to close it as a duplicate – chattershuts Feb 23 '22 at 08:28

0 Answers0