def flatten(dct, separator='_'):
    """A fast way to flatten a dictionary,"""
res = {}
queue = [('', dct)]
while queue:
    prefix, d = queue.pop()
for k, v in list(d.items()):
    key = prefix + k
if not isinstance(v, dict):
    res[key] = v
else:
    queue.append((key + separator, v))
return res

def records_from_json(fh):
    """Yields the records from a file object."""
rows = csv.reader(fh, delimiter='|')
header = next(rows)
for ident, dist, data in rows:
    rec = flatten(json.loads(data))
rec['id'] = ident
rec['dist'] = dist
yield rec

def from_records(path):
    with open(path) as fh:
        return pd.DataFrame.from_records(records_from_json(fh))
Извлечь вложенный JSON, встроенный в виде строки в кадр данных Pandas