I have data frame x,
Please view the x dataframe here
We want to create new column using below function, which will add Complete columns value in start and create new column finish.
import datetime
def date_by_adding_business_days(from_date, add_days):
business_days_to_add = add_days
current_date = from_date
while business_days_to_add > 0:
current_date += datetime.timedelta(days=1)
weekday = current_date.weekday()
if weekday >= 5: # sunday = 6
continue
business_days_to_add -= 1
return current_date
I have tried this getting below error, please help.
x['Finish'] = x.apply(date_by_adding_business_days(datetime.date.today(), x['Complete']))
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
