I have never worked with json files before. Currently this is what I am doing:
df = pd.read_json("precincts-with-results.geojson.gz")
df['features']
This is the result from above:
{'type': 'Feature',
'properties': {'GEOID': '05047-1-A (Oz Wd 1)',
'votes_dem': 79,
'votes_rep': 279,
'votes_total': 366,
'votes_per_sqkm': 54.2,
'pct_dem_lead': -54.6},
'geometry': {'type': 'MultiPolygon',
'coordinates': [[[[-93.88536364311612, 35.483758439321655],
[-93.8840470388143, 35.483727092097084],
[-93.88403177163875, 35.483726728784056],
[-93.88403177478405, 35.48372661335151],
[-93.87956152062023, 35.483586322546344],
[-93.87520339804045, 35.48339873745174],
[-93.87534656033012, 35.480428139370346],
[-93.87604589142236, 35.48045051399295], ...
I want a data frame that would look like this:
GEOID votes_dem votes_rep votes_total votes_per_sqkm pct_dem_lead
05047-1-A (Oz Wd 1) 79 279 366 54.2 -54.6
You can download the dataset here (size 264 mb): https://int.nyt.com/newsgraphics/elections/map-data/2020/national/precincts-with-results.geojson.gz
Help and code appreciated !!