I want to be able to iterate through the rows in my data frame and be able to replace the current number with an +1 incremental number (that starts @ 1000) every time the number changes.
Here is my dataframe column with the desired number next to it:
deal_pos_code
657 > 1000
680 > 1001
694 > 1002
694 > 1002
694 > 1002
694 > 1002
695 > 1003
695 > 1003
695 > 1003
695 > 1003
696 > 1004
696 > 1004
Update
I am new but this is what I have so far:
cv = df['deal_pos_code'].iloc[0]
nv = 1000
for i, row in mbn.iterrows():
if mbn.row['deal_pos_code'] == cv:
row['deal_pos_code'] = nv
else:
nv +=
cv = row['deal_pos_code']
row['deal_pos_code'] = nv
I am getting an attribute error: AttributeError: 'DataFrame' object has no attribute 'row'
Update.. bottom lines fixed on table