marcov2_to_v1_tojsonl.py 368 字节
Newer Older
Q
qiuxuezhong 已提交
1 2
import sys
import json
Y
Yibing Liu 已提交
3
import pandas as pd 
Q
qiuxuezhong 已提交
4 5 6 7 8 9 10 11 12 13

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print('Usage: tojson.py <input_path> <output_path>')
        exit()
    infile = sys.argv[1]
    outfile = sys.argv[2]
    df = pd.read_json(infile)
    with open(outfile, 'w') as f:
        for row in df.iterrows():
Y
Yibing Liu 已提交
14
            f.write(row[1].to_json() + '\n')