我有一个带有以下列的数据框:设备,值和条件。条件列是基于值列的计算得出的派生列。我已经在for循环中创建了此计算,但是我需要为每个设备重置循环。如何在熊猫中做到这一点?
条件逻辑是这样的:
docker build
感谢帮助!
condition = False
condition_series = []
for row in df.iterrows():
if row[1]['no_of_previous_rows_greater_than_threshold']==NUM_PREV_ROWS:
condition = True
if row[1]['value_greater_than_db_threshold']==False:
condition = False
condition_series.append(condition)