File size: 406 Bytes
6ef4eb1
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from pathlib import Path
import pandas as pd

file_names = ["./raw/dev.json", "./raw/test.json", "./raw/train.json"]
for file_name in file_names:
    # Read the JSON file into a DataFrame
    df = pd.read_json(file_name)

    # Convert the DataFrame to JSON Lines and write to a file_name
    jsonl_path = "./raw/" + Path(file_name).stem + ".jsonl"
    df.to_json(jsonl_path, orient="records", lines=True)