File size: 654 Bytes
9bf75c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import csv
import json

# Update file paths
csv_file_path = "/Users/aaronpinto/Downloads/HistoricalData_1731642761305.csv"  # Adjusted to match the terminal output
json_file_path = "/Users/aaronpinto/Downloads/HistoricalData_1731642761305.jsonl"

# Read the CSV and write to JSONL
with open(csv_file_path, mode='r', encoding='utf-8') as csv_file, open(json_file_path, mode='w', encoding='utf-8') as jsonl_file:
    csv_reader = csv.DictReader(csv_file)
    
    for row in csv_reader:
        json.dump(row, jsonl_file)
        jsonl_file.write('\n')  # Newline after each JSON object

print(f"Conversion complete! JSONL file saved to {json_file_path}")