2WikiMultihopQA / convert_to_parquet.py
Souradeep Nanda
initial commit
6ef4eb1
raw
history blame contribute delete
537 Bytes
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}")