-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ef27f6
commit a79c008
Showing
3 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
import json | ||
import pandas as pd | ||
|
||
""" | ||
This script writes a json file with zip codes (key) and the number of pharmacies in that zip code (value). | ||
Adjust code to filter for 'source': either 'gp' or 'fsq' | ||
""" | ||
|
||
tmp = pd.read_csv("pharmacy_ga.csv") | ||
# Read df in | ||
tmp = pd.read_csv("../Data/GA_Pharmacy_Data_gp_fsq/pharmacy_ga.csv") | ||
|
||
# Drop rows where zipcode is None | ||
tmp = tmp.dropna(subset=['zipcode']) | ||
tmp = tmp.reset_index(drop=True) | ||
|
||
# Cast zipcode to int | ||
tmp.zipcode = tmp.zipcode.astype(int) | ||
|
||
tmp_gp = tmp[tmp.source == 'gp'] | ||
# To select pharmacies from Google Places: 'gp' | ||
# To select pharmacies from Foursquare: 'fsq' | ||
tmp_gp = tmp[tmp.source == 'fsq'] | ||
|
||
# Count number of pharmacies per zipcode | ||
agg_gp = tmp_gp.groupby(by=["zipcode"]).count() | ||
agg_json = agg_gp.to_dict() | ||
|
||
with open("zipdata.json", "w") as outfile: | ||
# Write to json -- 'census' column is arbitrary, used to write dict keys, values at 'zipcode' level. | ||
with open("fsq_zipdata.json", "w") as outfile: | ||
outfile.write(json.dumps(agg_json["census"])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"30002": 10, "30004": 75, "30005": 151, "30008": 42, "30009": 61, "30011": 11, "30012": 74, "30013": 21, "30014": 19, "30016": 6, "30017": 22, "30019": 28, "30021": 24, "30022": 164, "30024": 209, "30028": 9, "30030": 131, "30032": 102, "30033": 181, "30034": 81, "30035": 86, "30038": 5, "30039": 33, "30040": 154, "30041": 146, "30043": 162, "30044": 115, "30045": 16, "30046": 167, "30047": 172, "30052": 67, "30054": 2, "30058": 86, "30060": 150, "30062": 277, "30064": 87, "30066": 83, "30067": 197, "30068": 145, "30071": 140, "30072": 1, "30075": 187, "30076": 201, "30078": 160, "30079": 5, "30080": 228, "30082": 72, "30083": 92, "30084": 169, "30087": 61, "30088": 8, "30092": 179, "30093": 140, "30094": 49, "30096": 274, "30097": 130, "30101": 110, "30102": 23, "30106": 82, "30107": 3, "30114": 44, "30115": 32, "30117": 18, "30118": 1, "30120": 26, "30121": 7, "30122": 42, "30126": 39, "30127": 59, "30132": 19, "30134": 69, "30135": 102, "30141": 22, "30143": 27, "30144": 193, "30152": 68, "30153": 1, "30157": 1, "30161": 66, "30165": 108, "30168": 14, "30175": 2, "30179": 6, "30180": 34, "30188": 78, "30189": 118, "30204": 1, "30213": 7, "30214": 89, "30215": 20, "30223": 29, "30224": 60, "30228": 5, "30233": 21, "30236": 129, "30238": 12, "30240": 83, "30241": 13, "30248": 22, "30252": 13, "30253": 65, "30260": 92, "30263": 31, "30265": 94, "30269": 129, "30273": 3, "30274": 98, "30276": 1, "30277": 2, "30281": 137, "30286": 13, "30290": 36, "30291": 6, "30294": 28, "30295": 4, "30296": 37, "30297": 50, "30303": 66, "30305": 107, "30306": 77, "30307": 64, "30308": 70, "30309": 131, "30310": 46, "30311": 58, "30312": 88, "30313": 12, "30314": 22, "30315": 57, "30316": 49, "30317": 16, "30318": 125, "30319": 107, "30322": 26, "30324": 106, "30326": 29, "30327": 88, "30328": 198, "30329": 146, "30331": 42, "30334": 2, "30336": 17, "30337": 45, "30338": 166, "30339": 175, "30340": 74, "30341": 176, "30342": 201, "30344": 107, "30345": 78, "30346": 31, "30349": 115, "30350": 78, "30354": 36, "30360": 32, "30363": 12, "30436": 9, "30458": 105, "30461": 3, "30474": 10, "30501": 168, "30504": 27, "30506": 4, "30507": 10, "30513": 37, "30517": 1, "30518": 87, "30519": 27, "30523": 3, "30528": 1, "30529": 10, "30530": 1, "30531": 4, "30534": 2, "30535": 4, "30540": 53, "30542": 24, "30548": 1, "30549": 4, "30553": 1, "30566": 39, "30568": 1, "30577": 3, "30601": 52, "30602": 3, "30605": 95, "30606": 215, "30607": 30, "30622": 23, "30628": 2, "30635": 3, "30641": 1, "30642": 11, "30650": 19, "30655": 2, "30656": 2, "30666": 1, "30677": 8, "30680": 38, "30683": 7, "30701": 58, "30705": 21, "30710": 1, "30720": 92, "30721": 23, "30725": 3, "30728": 12, "30736": 1, "30739": 5, "30741": 17, "30742": 7, "30755": 4, "30809": 46, "30810": 2, "30813": 11, "30814": 1, "30815": 6, "30830": 2, "30901": 16, "30904": 96, "30906": 75, "30907": 158, "30909": 115, "30912": 28, "31005": 3, "31008": 12, "31015": 7, "31021": 76, "31028": 1, "31030": 5, "31032": 19, "31061": 59, "31062": 1, "31069": 7, "31076": 3, "31088": 166, "31093": 84, "31201": 101, "31204": 90, "31206": 31, "31207": 3, "31210": 175, "31211": 15, "31216": 3, "31217": 47, "31220": 1, "31302": 1, "31305": 5, "31313": 82, "31322": 5, "31324": 50, "31326": 37, "31401": 95, "31404": 78, "31405": 50, "31406": 125, "31407": 1, "31408": 29, "31410": 19, "31411": 1, "31415": 6, "31419": 77, "31501": 98, "31503": 4, "31516": 1, "31520": 88, "31522": 31, "31523": 2, "31525": 16, "31548": 20, "31553": 2, "31558": 41, "31601": 49, "31602": 169, "31605": 27, "31635": 1, "31638": 1, "31701": 112, "31705": 27, "31707": 123, "31709": 49, "31719": 2, "31721": 7, "31730": 5, "31757": 1, "31763": 8, "31768": 28, "31788": 3, "31792": 88, "31793": 8, "31794": 90, "31808": 4, "31901": 82, "31903": 14, "31904": 178, "31906": 45, "31907": 50, "31909": 129} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"30004": 2, "30005": 3, "30008": 3, "30009": 3, "30011": 2, "30012": 6, "30013": 2, "30014": 8, "30016": 8, "30017": 1, "30019": 4, "30021": 3, "30022": 5, "30024": 5, "30025": 1, "30028": 1, "30030": 2, "30032": 4, "30033": 4, "30034": 3, "30035": 3, "30038": 3, "30039": 4, "30040": 7, "30041": 8, "30043": 8, "30044": 6, "30045": 2, "30046": 6, "30047": 6, "30052": 10, "30054": 1, "30056": 2, "30058": 5, "30060": 4, "30062": 5, "30064": 8, "30066": 4, "30067": 3, "30068": 1, "30071": 2, "30075": 4, "30076": 2, "30078": 7, "30079": 1, "30080": 7, "30083": 8, "30084": 4, "30087": 2, "30092": 3, "30093": 3, "30094": 2, "30096": 2, "30097": 4, "30101": 4, "30102": 3, "30103": 2, "30104": 1, "30105": 1, "30106": 3, "30107": 3, "30108": 3, "30110": 6, "30113": 2, "30114": 8, "30115": 4, "30116": 4, "30117": 13, "30120": 11, "30121": 5, "30122": 3, "30124": 1, "30125": 4, "30126": 6, "30127": 6, "30132": 7, "30134": 8, "30135": 10, "30137": 1, "30139": 2, "30141": 2, "30143": 6, "30144": 5, "30145": 2, "30147": 1, "30152": 2, "30153": 1, "30157": 2, "30161": 10, "30165": 11, "30168": 2, "30170": 2, "30171": 1, "30173": 1, "30176": 3, "30178": 2, "30179": 3, "30180": 10, "30183": 1, "30184": 2, "30185": 1, "30187": 1, "30188": 3, "30189": 3, "30204": 2, "30205": 1, "30206": 1, "30214": 7, "30216": 1, "30217": 2, "30218": 1, "30220": 1, "30222": 1, "30223": 8, "30224": 7, "30228": 7, "30230": 2, "30233": 6, "30234": 1, "30236": 7, "30238": 5, "30240": 11, "30241": 8, "30248": 4, "30251": 1, "30252": 7, "30253": 11, "30257": 1, "30258": 1, "30260": 4, "30263": 11, "30265": 4, "30268": 1, "30269": 3, "30273": 1, "30274": 6, "30276": 2, "30277": 1, "30281": 12, "30286": 5, "30290": 2, "30291": 3, "30292": 1, "30293": 1, "30294": 4, "30295": 4, "30296": 4, "30297": 5, "30303": 3, "30305": 3, "30306": 1, "30307": 2, "30308": 5, "30309": 2, "30310": 3, "30311": 5, "30312": 2, "30313": 1, "30315": 2, "30316": 2, "30318": 4, "30319": 5, "30322": 1, "30324": 2, "30326": 1, "30327": 2, "30328": 3, "30329": 5, "30331": 5, "30336": 1, "30337": 1, "30338": 3, "30339": 5, "30340": 3, "30341": 2, "30342": 3, "30344": 3, "30345": 2, "30349": 3, "30350": 2, "30401": 2, "30410": 1, "30411": 1, "30415": 2, "30417": 5, "30420": 1, "30421": 1, "30423": 1, "30425": 1, "30427": 5, "30428": 1, "30434": 1, "30436": 5, "30439": 5, "30441": 1, "30442": 1, "30445": 2, "30450": 1, "30453": 2, "30456": 1, "30457": 2, "30458": 8, "30461": 4, "30467": 5, "30471": 1, "30473": 1, "30474": 5, "30477": 2, "30501": 6, "30504": 1, "30506": 5, "30507": 4, "30510": 1, "30511": 2, "30512": 8, "30513": 4, "30517": 1, "30518": 4, "30519": 3, "30520": 2, "30521": 2, "30523": 5, "30525": 3, "30527": 2, "30528": 5, "30529": 4, "30531": 5, "30533": 7, "30534": 7, "30535": 1, "30536": 2, "30537": 1, "30540": 6, "30542": 5, "30543": 1, "30545": 1, "30546": 4, "30547": 1, "30548": 4, "30549": 5, "30553": 5, "30554": 2, "30555": 1, "30558": 1, "30559": 1, "30560": 2, "30562": 1, "30563": 2, "30564": 1, "30565": 2, "30566": 2, "30575": 1, "30576": 1, "30577": 9, "30582": 2, "30601": 4, "30605": 6, "30606": 8, "30607": 2, "30620": 2, "30621": 1, "30622": 2, "30627": 1, "30628": 1, "30629": 1, "30631": 1, "30633": 3, "30635": 4, "30641": 1, "30642": 3, "30643": 5, "30646": 3, "30648": 1, "30650": 2, "30655": 6, "30656": 1, "30660": 1, "30662": 6, "30663": 1, "30665": 1, "30666": 1, "30668": 1, "30669": 1, "30673": 4, "30677": 2, "30680": 6, "30683": 1, "30701": 15, "30705": 12, "30707": 3, "30710": 1, "30711": 3, "30720": 7, "30721": 13, "30725": 1, "30728": 8, "30730": 1, "30731": 1, "30733": 1, "30734": 1, "30735": 1, "30736": 8, "30739": 1, "30740": 1, "30741": 4, "30742": 5, "30747": 5, "30750": 1, "30753": 2, "30755": 3, "30756": 1, "30802": 2, "30805": 1, "30808": 1, "30809": 5, "30810": 1, "30813": 4, "30814": 3, "30815": 9, "30817": 3, "30823": 1, "30824": 4, "30828": 1, "30830": 4, "30833": 2, "30901": 3, "30904": 3, "30906": 8, "30907": 7, "30909": 9, "31001": 2, "31002": 1, "31003": 1, "31005": 2, "31006": 1, "31007": 1, "31008": 7, "31011": 1, "31012": 1, "31014": 1, "31015": 5, "31018": 1, "31019": 1, "31021": 11, "31022": 1, "31023": 5, "31024": 5, "31027": 2, "31029": 3, "31030": 4, "31031": 2, "31032": 3, "31033": 1, "31035": 1, "31036": 5, "31041": 1, "31042": 1, "31044": 2, "31046": 2, "31047": 2, "31049": 1, "31052": 2, "31055": 2, "31057": 1, "31058": 1, "31060": 1, "31061": 11, "31063": 2, "31064": 3, "31068": 1, "31069": 6, "31071": 1, "31072": 1, "31075": 1, "31076": 1, "31077": 1, "31078": 1, "31079": 1, "31082": 4, "31085": 1, "31087": 2, "31088": 9, "31089": 1, "31090": 1, "31091": 2, "31092": 1, "31093": 9, "31096": 1, "31097": 1, "31201": 5, "31204": 4, "31206": 3, "31210": 4, "31211": 4, "31216": 5, "31217": 5, "31220": 3, "31302": 2, "31303": 1, "31305": 2, "31307": 1, "31308": 3, "31309": 1, "31312": 4, "31313": 8, "31316": 2, "31320": 1, "31321": 2, "31322": 6, "31323": 1, "31324": 4, "31326": 6, "31329": 1, "31331": 3, "31401": 3, "31404": 4, "31405": 10, "31406": 5, "31407": 3, "31408": 4, "31410": 4, "31415": 1, "31419": 5, "31501": 5, "31503": 4, "31510": 4, "31512": 1, "31513": 5, "31516": 7, "31519": 1, "31520": 7, "31522": 4, "31523": 3, "31525": 6, "31532": 1, "31533": 7, "31535": 3, "31537": 5, "31539": 5, "31542": 1, "31543": 2, "31544": 1, "31545": 8, "31546": 1, "31548": 5, "31549": 3, "31551": 1, "31553": 3, "31554": 2, "31555": 1, "31557": 1, "31558": 6, "31562": 1, "31563": 1, "31565": 1, "31566": 2, "31567": 1, "31569": 3, "31601": 7, "31602": 9, "31605": 3, "31606": 1, "31620": 2, "31622": 1, "31624": 1, "31626": 1, "31627": 1, "31631": 1, "31632": 1, "31634": 3, "31635": 1, "31636": 1, "31637": 1, "31638": 1, "31639": 4, "31641": 1, "31642": 2, "31643": 2, "31645": 2, "31647": 1, "31648": 1, "31650": 1, "31701": 6, "31705": 6, "31707": 14, "31709": 5, "31712": 1, "31714": 2, "31716": 1, "31719": 1, "31720": 1, "31721": 1, "31722": 1, "31730": 4, "31733": 1, "31738": 1, "31744": 1, "31747": 1, "31749": 1, "31750": 5, "31757": 2, "31763": 6, "31764": 1, "31765": 1, "31768": 5, "31771": 1, "31773": 1, "31774": 4, "31775": 2, "31778": 1, "31779": 1, "31780": 1, "31787": 1, "31788": 2, "31789": 1, "31790": 1, "31791": 5, "31792": 8, "31793": 3, "31794": 9, "31795": 1, "31796": 1, "31801": 1, "31803": 1, "31804": 1, "31805": 1, "31806": 2, "31807": 1, "31808": 3, "31810": 1, "31811": 1, "31815": 1, "31816": 4, "31820": 1, "31822": 1, "31823": 1, "31824": 2, "31825": 1, "31826": 1, "31827": 1, "31830": 1, "31831": 1, "31833": 2, "31901": 3, "31903": 4, "31904": 9, "31906": 4, "31907": 8, "31909": 6, "39813": 3, "39815": 1, "39817": 4, "39819": 3, "39823": 2, "39827": 1, "39828": 4, "39834": 1, "39837": 3, "39840": 3, "39841": 1, "39842": 2, "39845": 5, "39846": 2, "39851": 1, "39854": 1, "39859": 1, "39861": 1, "39870": 1, "39886": 1, "39897": 1} |