time-series / import csv.py
aaronjpi's picture
add dataset
9bf75c3
raw
history blame contribute delete
654 Bytes
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}")