ECSP




Pay Notebook Creator: Haige Cui0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [3]:
import subprocess
subprocess.call('pip install geopy'.split())
subprocess.call('pip install folium'.split())
Out[3]:
0
In [4]:
import pandas as pd
from geopy import GoogleV3
import folium
In [5]:
df = pd.read_csv("./table_data.csv")
df.head()
Out[5]:
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style>
Company Name BIN Industry Business Program Effective Date Address Postcode Borough Latitude Longitude Month Count Periodic Savings Total Tree Count within 0.5 Mile Periodic Savings within 0.5 Mile
0 139 ACA Realty, Inc. 4003160 Commercial Limousine Service ICIP 4/7/2008 43-23 35th Street 11101 QUEENS 40.745706 -73.929565 116 1068.75 683 1423.931818
1 141 Lake Avenue Realty c/o JR Produce, Inc. 5146740 Wholesale/Warehouse/Distribution Dist. of prepacked salads ICIP 12/8/2009 141 Lake Avenue 10303 STATEN IS 40.633153 -74.150999 96 494.93 21 336.525000
2 14-10 123rd Street LLC 4098344 Commercial Electrical Parts Mfg. ICIP 3/4/2011 14-10 123rd Street 11356 QUEENS 40.785144 -73.844833 81 263.25 447 1079.380000
3 183 Lorriane Street LLC 3336622 Wholesale/Warehouse/Distribution Commercial Storage facility ICIP 11/6/2015 183 Lorraine Street 11231 BROOKLYN 40.673106 -74.002300 25 4200.66 224 2846.165714
4 21st Century Optics, Inc. 4003447 Manufacturing Eye glasses Tenant 1/7/2009 47-00 33rd Street 11101 QUEENS 40.742386 -73.932148 107 2016.42 658 1524.019111
In [6]:
from geopy import GoogleV3

def get_lonlat(address):
    # Convert address to latitude and longitude
    geocode = GoogleV3('AIzaSyDNqc0tWzXHx_wIp1w75-XTcCk4BSphB5w').geocode
    location = geocode(address)
    return location
In [7]:
one_address = "43-23 35th Street, NY"
x = get_lonlat(one_address)
print(x)
43-23 35th St, Long Island City, NY 11101, USA
In [8]:
#folium_map = folium.Map(location=[40.738, -73.98], tiles= "Mapbox Bright", zoom_start=12)
folium_map = folium.Map(location=[40.738, -73.98],  zoom_start=12)
marker = folium.CircleMarker(location=[x.latitude, x.longitude])
marker.add_to(folium_map)
folium_map
Out[8]:
<iframe src="data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVs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yZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwXzk3MmMxYTg2OTlkMTQ1MzBiZDgyYzkxNmI0YTMxYzNjKTsKICAgIAogICAgICAgICAgICB2YXIgY2lyY2xlX21hcmtlcl9jODFmMzI4MzdjNWI0MTI4YmE2NWQ3MTUyZjgyNTNiYSA9IEwuY2lyY2xlTWFya2VyKAogICAgICAgICAgICAgICAgWzQwLjc0NTUzNDMsIC03My45MjkyODI1MDAwMDAwMV0sCiAgICAgICAgICAgICAgICB7CiAgImJ1YmJsaW5nTW91c2VFdmVudHMiOiB0cnVlLAogICJjb2xvciI6ICIjMzM4OGZmIiwKICAiZGFzaEFycmF5IjogbnVsbCwKICAiZGFzaE9mZnNldCI6IG51bGwsCiAgImZpbGwiOiBmYWxzZSwKICAiZmlsbENvbG9yIjogIiMzMzg4ZmYiLAogICJmaWxsT3BhY2l0eSI6IDAuMiwKICAiZmlsbFJ1bGUiOiAiZXZlbm9kZCIsCiAgImxpbmVDYXAiOiAicm91bmQiLAogICJsaW5lSm9pbiI6ICJyb3VuZCIsCiAgIm9wYWNpdHkiOiAxLjAsCiAgInJhZGl1cyI6IDEwLAogICJzdHJva2UiOiB0cnVlLAogICJ3ZWlnaHQiOiAzCn0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXBfOTcyYzFhODY5OWQxNDUzMGJkODJjOTE2YjRhMzFjM2MpOwogICAgICAgICAgICAKPC9zY3JpcHQ+" style="position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>
In [ ]: