I have this dataset that simulates a company that sells financial products. I want to go through each row and create a new column that would be the summatory of the columns entry_date and dias_en_cartera. This column is called last_time_active.
I also want to create another column(boolean) called active_now that tells me if the day on last_time_active is smaller than today.
for index, row in df_cuenta.iterrows():
last_date= row['entry_date'] + timedelta(days=row['días_encartera'])
df_cuenta.insert(16,"last_date_active", last_date)
if row['last_time_active']<now:
df_cuenta.insert(17,"active_now", 0)
else:
df_cuenta.insert(17,"active_now", 1)