I want to place a new value on new column based on a condition like this:
temp['month'] = diff_month(datetime.now() if temp['endda_x'].astype('str').str.startswith('9999') else pd.to_datetime(temp['endda_x']), pd.to_datetime(temp['begda_x']))
so, if column endda_x starts with '9999' the month difference will calculated by today's date. but if it doesn't, the month difference will be calculated by that date.
but the error occurs:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I know that error but I am not really sure if it is in this case. I'll appreciate the answer, Thank you