This file contains hidden or 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
| import pandas as pd | |
| import requests | |
| import json | |
| addres_list = list(McDonalds_data['address']) #prepare variable to pass to URL | |
| state_list = list(McDonalds_data['state']) #prepare variable to pass to URL | |
| placesAPI_data = pd.DataFrame(columns=['formatted_address', 'name', 'permanently_closed']) #initialize dataframe | |
| for i in range(len(addres_list)): | |
| address = addres_list[i].replace(' ', '%20') #make sure there are no blank spaces for the URL | |
| state = state_list[i] |
This file contains hidden or 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
| def read_shapefile(shp_path): | |
| """ | |
| Read a shapefile into a Pandas dataframe with a 'coords' column holding | |
| the geometry information. This uses the pyshp package | |
| """ | |
| import shapefile | |
| #read file, parse out the records and shapes | |
| sf = shapefile.Reader(shp_path) | |
| fields = [x[0] for x in sf.fields][1:] |