Last active
August 27, 2019 15:43
-
-
Save Yousuf28/6361d34501c8e0945c509b004f951ce7 to your computer and use it in GitHub Desktop.
AI for drug discovery article
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
#import library | |
from googlegeocoder import GoogleGeocoder | |
# put your key | |
geocoder = GoogleGeocoder("your key") | |
# create csv file to save latitude and longitude | |
csv_file = open('start_up_ai.csv', 'ab') | |
writer = csv.writer(csv_file, dialect='excel', delimiter=',', encoding='utf-8') | |
writer.writerow(['lat', 'lng']) | |
df_address = df_add['address'] | |
# address that does not work save into list | |
no_lat =[] | |
for k in df_address: | |
try: | |
search = geocoder.get(k) | |
lat = search[0].geometry.location.lat | |
lng = search[0].geometry.location.lng | |
writer.writerow([lat, lng]) | |
except: | |
no_lat.append(k) | |
pass | |
csv_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment