Python: Compare several rows with one element in a dataframe

Viewed 33

if i have a Dataframe table and i want to for example compare one row with the value 100 with another row in the same column that has the same value but is one or two indexes lower and iterate through the whole table doing this. How can i code this?

Is this a good approach?:

for index, row in df.iterrows():
 if index-2 == 100:
    blabla
 else:
    blubblubb
0 Answers
Related