pandas add attribute while iterating code example Example: pandas for loop after loc reset_index df.reset_index(inplace=True)