# 如何基于特定列值以增量因子循环数据框

vid2               FStart FEnd cap2                                               VDuration  COS  cap1
0    -_aaMGK6GGw_57_61  0      3    A man grabbed a boy from his collar and threw ...  4          2    A man and woman are yelling at a young boy and...  0.253792   0.750000
1    -_aaMGK6GGw_57_61  3      4    A lady is waking up a man lying on a chair and...  4          2    A man and woman are yelling at a young boy and...  0.192565   0.250000
2    -_hbPLsZvvo_5_8    0      1    A white dog is barking and a caption is writte...  3          2    a dog barking and cooking with her master in t...  0.562707   0.333333
...                ...    ...  ...                                                ...        ...  ...
379  6Lzq1HN33lE_5_15   0      10   A man is playing flute.                            10         1    A man is playing the title song of 'The Titani...  0.363582   1.000000
380  6mYnZbIwcNo_10_16  0      6    A man is typing using an external keyboard att...  6          1    One types on ...                                   0.365895   1.000000
381  6njscWrdnM0_8_18   0      5    A man practicing kicks on a toy torso dummy fa...  10         2    A time a man karate kicks a mannequin he fa...     0.187248   0.500000
382  6njscWrdnM0_8_18   5      10   The man is punching the dummy.                     10         2   Each time a man karate kicks a mannequin he fa...   0.234586   0.500000

vems_score = 0.0

video_scores = []

for i, row in merged.iterrows():
vid_score = 0.0
total_weight = 0.0

for j in range(row['COS']):
total_weight = total_weight + row['FWeight']
vid_score = vid_score + (row['FWeight'] * row['fsim'])

i = i + row['COS']

vid_score = vid_score/total_weight
video_scores.append(vid_score)

print(video_scores)