Python: Pandas dataframe and for loop - seperate row variable outside of loop body
First of all, when using pandas, it is better to avoid for-loops as much as we can. It is faster to use pandas methods and there are plenty for everything you can do with a for loop.
For your case, you can define what you want to do in a function and pass it to the apply()
method of pandas data frames. For example:
def body_for_loop(row, region_index):
name = row["Name"]
regions = row.filter(regex = '^Region').values
# body of loop
Now when you want to use it, you will just call:
df.apply(body_fro_loop, axis=1)