0

json_list:

[{"category": "bicycle-theft", "location_type": "Force", "location": {"latitude": "52.192042", "street": {"id": 1230421, "name": "On or near Newport Street"}, "longitude": "-2.226028"}, "context": "", "outcome_status": {"category": "Under investigation", "date": "2021-03"}, "persistent_id": "e521c49fa1be0734f967be41f4a77dd730f85f544a7d747f728b20c2fc5e0932", "id": 91082767, "location_subtype": "", "month": "2021-03"}, {"category": "bicycle-theft", "location_type": "Force", "location": {"latitude": "52.195566", "street": {"id": 1231061, "name": "On or near Pierpoint Street"}, "longitude": "-2.221277"}, "context": "", "outcome_status": {"category": "Under investigation", "date": "2021-03"}, "persistent_id": "41a055064448e4e10995573983cf547f426dbcbecfa8d936d78cb9ae4b9453fc", "id": 91085305, "location_subtype": "", "month": "2021-03"}]

code:

import pandas
jn=pandas.DataFrame.from_records(json_list)
print(jn)

output:

          category location_type                                           location  ...        id location_subtype    month
0    bicycle-theft         Force  {'latitude': '52.192042', 'street': {'id': 123...  ...  91082767                   2021-03
1    bicycle-theft         Force  {'latitude': '52.195566', 'street': {'id': 123...  ...  91085305                   2021-03

is there a way to convert the list into a proper dataframe/table? Instead of {'latitude': '52.192042', 'street': {'id': 123... these outputs shown as separate attributes or anything close to that would be desirable

joel
  • 25
  • 1
  • 6

0 Answers0