Created
January 8, 2020 18:00
-
-
Save mapmeld/acdb0a46641f4017bfb9a066b1b1a4d1 to your computer and use it in GitHub Desktop.
Count number of saved plans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculate number of plans, by state | |
import json | |
plans = open('districtr_full_export.json', 'r').read().strip().split("\n") | |
places = {} | |
for raw in plans: | |
plan = json.loads(raw) | |
if ("plan" in plan) and ("placeId" in plan["plan"]): | |
place = plan["plan"]["placeId"] | |
if place in places: | |
places[place] += 1 | |
else: | |
places[place] = 1 | |
print(places) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment