File size: 335 Bytes
518bc37
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import pandas as pd
import json

metadata_df = pd.read_csv("metadata.csv")

print(metadata_df.head())

json_dict = metadata_df.to_dict(orient='records')

with open('metadata.jsonl', 'w') as f:
    for entry in json_dict:
        # Convert each dictionary to a JSON string and write to the file
        f.write(json.dumps(entry) + '\n')