@@ -0,0 +1,1508 @@
+import pandas as pd%0Aimport numpy as np%0Aimport time%0A%0Apred_csv = %5B%0A('video_level_logistic_model_skew_rgb_frame_n',0.544)%0A,('video_level_logistic_model_q3_rgb_audio_frame_n',0.752)%0A,('video_level_logistic_model_mean_rgb_audio_frame_n',0.755)%0A,('video_level_logistic_model_rgb_audio',0.743)%0A,('video_level_moe_model_7_rgb_audio',0.791)%0A%5D%0A%0Apred_csv = %5B('/data2/pred/'+x%5B0%5D+'.csv', x%5B1%5D) for x in pred_csv%5D%0A%0Ardrs = %5BNone%5D*len(pred_csv)%0Afor i, pc in enumerate(pred_csv):%0A    rdrs%5Bi%5D = pd.read_csv(pc%5B0%5D, chunksize=10000, skiprows=1, header=None)%0A%0Atm = time.time()%0Afor j in range(71):%0A    if j == 70:%0A        mat = np.zeros((10000, 640))%0A    else:%0A        mat = np.zeros((10000, 4716))%0A    for i, rdr in enumerate(rdrs):%0A        chnk = rdr.next()%0A        vids = chnk.iloc%5B:,0%5D.values%0A        mat += chnk.iloc%5B:,1:%5D.values*pred_csv%5Bi%5D%5B1%5D%0A        print(i,j)%0A    top_indices = np.argpartition(mat, -20)%5B:,-20:%5D%0A    lines = %5B%5BNone%5D*20 for _ in range(len(mat))%5D%0A    for a in range(mat.shape%5B0%5D):%0A        for b in range(20):%0A            lines%5Ba%5D%5Bb%5D = (top_indices%5Ba,b%5D, mat%5Ba,top_indices%5Ba,b%5D%5D)%0A    lines = %5Bsorted(line, key=lambda p: -p%5B1%5D) for line in lines%5D%0A    lines = %5B%5Bvids%5Bk%5D, %22 %22.join(%22%25i %25f%22 %25 pair for pair in line)%5D for k, line in enumerate(lines)%5D%0A    df = pd.DataFrame(lines)%0A    if(j==0):%0A        df.to_csv('/data2/pred/c.csv', index=False, header=%5B'VideoId','LabelConfidencePairs'%5D, mode='a')%0A    else:%0A        df.to_csv('/data2/pred/c.csv', index=False, header=False, mode='a')%0A    print(time.time() - tm)%0A

Create merge.py