18 lines
468 B
Python
Executable File
18 lines
468 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import json
|
|
import pandas
|
|
from flatten_json import flatten
|
|
|
|
f = open('ESV.json')
|
|
|
|
json_list = json.load(f)
|
|
key_list = ['book', 'chapter', 'verse', 'text']
|
|
json_list = [{k:d[k] for k in key_list} for d in json_list]
|
|
|
|
# Flatten and convert to a data frame
|
|
json_list_flattened = (flatten(d, '.') for d in json_list)
|
|
df = pandas.DataFrame(json_list_flattened)
|
|
|
|
export_csv = df.to_csv('esv.tsv', sep='\t', encoding='utf-8', index=None, header=True)
|