[SOLVED]
this worked for:
for lab, row in consig_df.iterrows():
consig_df.loc[lab,"start_loan"] = d - dateutil.relativedelta.relativedelta(months=row["number_of_quotas_paid"])
[SOLVED]
I have the following df:
[edit]
total_value quotas_value term number_of_quotas_paid
0 3500.00 544.21 24 24
1 11226.17 648.55 60 24
2 11547.00 578.06 96 18
3 1500.00 418.99 4 0
4 5500.00 2928.49 2 0
5 7758.00 393.00 60 12
6 1000.00 532.84 2 2
7 2250.00 623.95 4 0
8 600.00 217.97 3 3
9 600.00 165.85 4 2
I want to run a loop, create a new row and append the data. I'm trying to calculate what month the loan started based on the number of quotas already paid.
I'm stuck after the loop.
import datetime
import dateutil.relativedelta
d = datetime.datetime.strptime("2018-08-01", "%Y-%m-%d")
for lab, row in consig_df.iterrows():
comeco = d - dateutil.relativedelta.relativedelta(months=row["number_of_quotas_paid"])
How do I go from here, create a new row and append the data generated through the loop?
thanks