比较python中的行之间的值

比较python中的行之间的值,python,pandas,Python,Pandas,我是新来的熊猫,我想比较行,然后只进入另一个for循环 for i in node: temp_df=df[(df['NODE'])==i] min_time=min(temp_df['time1']) max_time=max(temp_df['time1']) while min_time<=max_time: print(min_time) df['No.Of_CellDown']=temp

我是新来的熊猫,我想比较行,然后只进入另一个for循环

for i in node:
    
    
    temp_df=df[(df['NODE'])==i]
    
    min_time=min(temp_df['time1'])
    max_time=max(temp_df['time1'])
    while min_time<=max_time:
        print(min_time)
        df['No.Of_CellDown']=temp_df['time1'].between(min_time,min_time + timedelta(minutes=5)).sum()
        print(count)
        min_time=min_time + timedelta(minutes=5)
节点中的i的
:
temp_df=df[(df['NODE'])==i]
最小时间=最小值(温度偏差['time1'])
最大时间=最大值(温度偏差['time1'])
当最小时间时,尝试:

试试这个

for index, row in temp_df.iterrows():
    if index -1 >= 0:
        if temp_df['Tech'][index-1] == row['Tech'] and  temp_df['Issue'][index-1] == row['Issue]:
            //Do your thing here
        else:
            print('different')
for index, row in temp_df.iterrows():
    if index -1 >= 0:
        if temp_df['Tech'][index-1] == row['Tech'] and  temp_df['Issue'][index-1] == row['Issue]:
            //Do your thing here
        else:
            print('different')