(This is not real data)
I requested similar data from a Rest API. Then, I was able to convert some of the data to a .ndJSON format ( lines = True ); however, the address column is still shown in the ndjson format structure similar to a Python dictionary. My goal is to have the following columns: Column 1 | Street Address | City | State | Postal Code | Zip Code | Birthdate |
This is the first row:
& address & birthDate & deceasedBoolean & \ 0 & {[}{'city': 'MURFREESBORO', 'line': {[}'9999 Candy Cane Island'{]}, 'postalCode': '39999', 'state': '56'}{]} & 11/10/2081 & 0 & \
import pandas as pd
import json
from io import StringIO
data = response.text
newdf = pd.read_json(StringIO(data),lines = True)
newdf.tail(10)
newdf.to_csv('file.csv')