File size: 537 Bytes
6ef4eb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from pathlib import Path
import pandas as pd
import json

file_names = ["./raw/dev.jsonl", "./raw/test.jsonl", "./raw/train.jsonl"]
for file_name in file_names:
    df = pd.read_json(file_name, lines=True)

    complex_columns = [
        "context",
        "supporting_facts",
        "evidences",
    ]
    for col in complex_columns:
        df[col] = df[col].apply(json.dumps)

    parquet_file_path = Path(file_name).stem + ".parquet"
    df.to_parquet(parquet_file_path)

    print(f"Converted {file_name} to {parquet_file_path}")