ECSP




Pay Notebook Creator: Haige Cui0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [1]:
# CrossCompute
ready_table_path = 'Table with average monthly savings(within 0.5 Mile) and tree count(within 0.5 Mile).csv'
search_radius_in_miles = 5

user_address = '28-10 Jackson Ave'

target_folder = '/tmp'
In [2]:
from geopy import GoogleV3
geocode = GoogleV3('AIzaSyDNqc0tWzXHx_wIp1w75-XTcCk4BSphB5w').geocode 
x = geocode(user_address)
user_coor = x.longitude, x.latitude
user_coor
Out[2]:
(-73.93824959999999, 40.7479424)
In [3]:
type(user_coor)
Out[3]:
tuple
In [4]:
# Load inputs
import pandas as pd
import numpy as np
ready_table = pd.read_csv(ready_table_path)
ready_table['Longitude'][0]
Out[4]:
-73.929565
In [5]:
import subprocess
subprocess.call('pip install geopandas'.split())
Out[5]:
0
In [6]:
from geopandas import GeoDataFrame
from shapely.geometry import Point

geometry = [Point(xy) for xy in zip(ready_table.Longitude, ready_table.Latitude)]
#ready_table = ready_table.drop(['Longitude', 'Latitude'], axis=1)
crs = {'init': 'epsg:4326'}
gdf = GeoDataFrame(ready_table, crs=crs, geometry=geometry)
gdf[:3]
Out[6]:
<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>
Unnamed: 0 Unnamed: 0.1 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 geometry
0 0 0 139 ACA Realty, Inc. 4003160 Commercial Limousine Service ICIP 2008-04-07 43-23 35th Street 11101 QUEENS 40.745706 -73.929565 116 1068.75 683 1423.931818 POINT (-73.929565 40.745706)
1 1 1 141 Lake Avenue Realty c/o JR Produce, Inc. 5146740 Wholesale/Warehouse/Distribution Dist. of prepacked salads ICIP 2009-12-08 141 Lake Avenue 10303 STATEN IS 40.633153 -74.150999 96 494.93 21 336.525000 POINT (-74.150999 40.633153)
2 2 2 14-10 123rd Street LLC 4098344 Commercial Electrical Parts Mfg. ICIP 2011-03-04 14-10 123rd Street 11356 QUEENS 40.785144 -73.844833 81 263.25 447 1079.380000 POINT (-73.84483299999999 40.785144)
In [7]:
# test
import geopy
import geopy.distance

#pt1 = user_coor
#pt2 = ref_coor
#dist = geopy.distance.distance(pt1, pt2).miles
#dist
In [8]:
# Choose a reference location 
In [9]:
from shapely import wkt
g = gdf.geometry[0]
g
#g.coords[0]
Out[9]:
<shapely.geometry.point.Point at 0x7f2cf8cd4c88>
In [10]:
#test
from shapely import wkt
g = gdf.geometry[1]
g.coords[0]
Out[10]:
(-74.150999, 40.633153)
In [11]:
type(g)
Out[11]:
shapely.geometry.point.Point
In [12]:
for i in range(0,len(gdf.geometry)):
        #Coordinate = []
    gdf.Coordinate = gdf.geometry[i].coords[0]
    print(gdf.Coordinate)
(-73.929565, 40.745706)
(-74.150999, 40.633153)
(-73.844833, 40.785144)
(-74.0023, 40.673106)
(-73.932148, 40.742385999999996)
(-73.995088, 40.746364)
(-73.889346, 40.676789)
(-73.931466, 40.745810999999996)
(-73.87113199999997, 40.665766)
(-73.896804, 40.77494)
(-73.949497, 40.745509999999996)
(-73.862139, 40.707402)
(-73.932208, 40.716031)
(-73.963076, 40.715227)
(-73.900755, 40.779184)
(-73.839512, 40.676351000000004)
(-73.982725, 40.65943)
(-73.846811, 40.720892)
(-73.899803, 40.752183)
(-73.95654, 40.72499000000001)
(-73.888513, 40.80819)
(-73.936863, 40.698747)
(-73.83452700000002, 40.786469)
(-73.95375899999998, 40.812964)
(-73.900288, 40.654623)
(-73.986681, 40.702763)
(-73.95375899999998, 40.812964)
(-73.997405, 40.660096)
(-73.846583, 40.848176)
(-73.956819, 40.679518)
(-73.89206800000002, 40.810008)
(-73.92214799999998, 40.730657)
(-73.939362, 40.762075)
(-73.952145, 40.656131)
(-74.022864, 40.645338)
(-73.951224, 40.74805300000001)
(-73.958833, 40.722996)
(-73.93324, 40.740913)
(-73.928728, 40.755140999999995)
(-73.801885, 40.696796)
(-73.985741, 40.694059)
(-73.93158000000003, 40.740357)
(-73.934421, 40.710477000000004)
(-73.752361, 40.660713)
(-73.93656800000002, 40.743168)
(-74.02484100000002, 40.64102800000001)
(-73.860861, 40.744199)
(-73.90329799999998, 40.810912)
(-73.996897, 40.662525)
(-73.913146, 40.716759)
(-73.932182, 40.740775)
(-73.764972, 40.681323)
(-73.92326800000002, 40.706817)
(-73.951224, 40.74805300000001)
(-73.98245899999998, 40.640848)
(-73.925887, 40.752096)
(-73.932167, 40.742197)
(-73.95564, 40.814215999999995)
(-74.022864, 40.645338)
(-73.90329399999997, 40.649894)
(-73.872648, 40.809733)
(-73.98344300000002, 40.581105)
(-73.946282, 40.74942)
(-73.901399, 40.695815)
(-74.014866, 40.65331)
(-73.89773100000002, 40.670294)
(-74.022864, 40.645338)
(-73.945972, 40.748624)
(-74.022864, 40.645338)
(-73.926734, 40.711043)
(-73.818689, 40.695926)
(-74.022864, 40.645338)
(-74.022864, 40.645338)
(-73.876414, 40.805254999999995)
(-73.933981, 40.742598)
(-73.956819, 40.679518)
(-73.932148, 40.742385999999996)
(-73.932148, 40.742385999999996)
(-73.977306, 40.631547999999995)
(-73.956819, 40.679518)
(-74.022864, 40.645338)
(-73.876414, 40.805254999999995)
(-74.003916, 40.681593)
(-73.990577, 40.693445000000004)
(-73.984868, 40.680538)
(-73.942538, 40.742724)
(-73.93751400000002, 40.743281)
(-73.99797099999998, 40.665937)
(-73.905178, 40.650211)
(-74.010851, 40.652712)
(-73.932148, 40.742385999999996)
(-73.88514, 40.805769)
(-73.876414, 40.805254999999995)
(-73.993677, 40.670218)
(-73.925887, 40.752096)
(-73.907629, 40.80337100000001)
(-73.886166, 40.822381)
(-74.006109, 40.654403)
(-73.82892700000002, 40.784639)
(-73.925141, 40.71587)
(-73.931265, 40.741954)
(-73.901638, 40.84177800000001)
(-73.937833, 40.741426000000004)
(-73.830545, 40.71513)
(-74.00814799999998, 40.682404999999996)
(-73.933139, 40.740902)
(-73.95564, 40.814215999999995)
(-73.950738, 40.736286)
(-73.87187, 40.804854)
(-73.953709, 40.723636)
(-73.951216, 40.748069)
(-73.775424, 40.662029)
(-73.920956, 40.771363)
(-73.943731, 40.748206)
(-73.93751400000002, 40.743281)
(-73.961625, 40.698242)
(-73.906839, 40.673567999999996)
(-73.906839, 40.673567999999996)
(-74.015629, 40.649234)
(-73.935833, 40.757018)
(-73.954468, 40.695654)
(-73.864953, 40.708643)
(-73.87772199999998, 40.66150800000001)
(-73.949285, 40.748483)
(-74.016574, 40.65163)
(-74.02272099999998, 40.646985)
(-73.876414, 40.805254999999995)
(-74.022864, 40.645338)
(-73.82775500000002, 40.757519)
(-73.935652, 40.74306)
(-73.917486, 40.739689)
(-74.022864, 40.645338)
(-73.87369100000002, 40.810305)
(-73.935652, 40.74306)
(-73.915867, 40.750033)
(-74.022864, 40.645338)
(-73.854823, 40.785665)
(-73.89293, 40.676158)
(-73.908265, 40.805545)
(-74.015712, 40.678253999999995)
(-74.022864, 40.645338)
(-73.936048, 40.755514)
(-73.948045, 40.728643)
(-73.99833100000002, 40.666156)
(-73.774736, 40.70463400000001)
(-73.73167099999998, 40.718175)
(-73.88643499999998, 40.806967)
(-74.017003, 40.652459)
(-73.953622, 40.812886999999996)
(-73.907201, 40.802237)
(-73.759058, 40.681472)
(-73.901421, 40.719695)
(-73.914291, 40.726479)
(-73.914291, 40.726479)
(-73.949225, 40.746928999999994)
(-73.900999, 40.671139000000004)
(-73.845843, 40.766816)
(-73.932261, 40.741725)
(-73.926553, 40.753743)
(-73.94170600000002, 40.753147999999996)
(-73.99754899999998, 40.66568400000001)
(-73.987898, 40.73520300000001)
(-73.876414, 40.805254999999995)
(-73.949282, 40.748483)
(-73.89556, 40.773816)
(-73.89556, 40.773816)
(-73.930409, 40.708045)
(-73.746684, 40.666407)
(-73.967512, 40.701526)
(-73.949701, 40.748206)
(-74.022864, 40.645338)
(-73.876414, 40.805254999999995)
(-73.906015, 40.805184000000004)
(-73.991628, 40.623705)
(-73.940568, 40.802929)
(-73.935968, 40.740233)
(-73.928747, 40.636521)
(-73.928747, 40.636521)
(-73.938484, 40.704687)
(-73.998209, 40.665231)
(-73.998209, 40.665231)
(-73.998209, 40.665231)
(-73.908282, 40.719945)
(-73.876414, 40.805254999999995)
(-74.23074, 40.537234999999995)
(-73.91790400000002, 40.643104)
(-73.99086899999998, 40.695201000000004)
(-73.955442, 40.738162)
(-73.876414, 40.805254999999995)
(-74.004183, 40.684708)
(-73.949065, 40.749237)
(-73.947213, 40.739917999999996)
(-74.022864, 40.645338)
(-73.903566, 40.76524600000001)
(-73.876414, 40.805254999999995)
(-73.94098699999998, 40.802355)
(-73.925887, 40.752096)
(-74.00223299999998, 40.717634000000004)
(-73.860098, 40.897944)
(-74.182637, 40.633645)
(-73.876414, 40.805254999999995)
(-73.989246, 40.675669)
(-74.002999, 40.752098)
(-73.779302, 40.665363)
(-73.894052, 40.814074)
(-73.95375899999998, 40.812964)
(-73.935824, 40.740189)
(-73.925887, 40.752096)
(-73.944744, 40.732015000000004)
(-73.950677, 40.735569)
(-73.897862, 40.775199)
(-73.907348, 40.660193)
(-73.935652, 40.74306)
(-74.004713, 40.741876)
(-73.966663, 40.6972)
(-73.966663, 40.6972)
(-73.929199, 40.675740999999995)
(-73.888274, 40.806719)
(-73.93594499999998, 40.749656)
(-73.798233, 40.761016999999995)
(-73.842191, 40.852806)
(-73.961816, 40.697278000000004)
(-73.914625, 40.727923)
(-73.997675, 40.666626)
(-74.01613, 40.676489000000004)
(-73.918986, 40.802366)
(-73.927934, 40.711376)
(-73.954391, 40.812647999999996)
(-73.931112, 40.746728000000004)
(-73.919543, 40.721144)
(-73.947563, 40.836017)
(-73.925887, 40.752096)
(-73.752361, 40.660713)
(-73.956819, 40.679518)
(-73.951224, 40.74805300000001)
(-74.022864, 40.645338)
(-73.948587, 40.750848)
(-73.844459, 40.830846)
(-73.9458, 40.751745)
(-73.821995, 40.699206)
(-73.77622, 40.701945)
(-73.936782, 40.742839000000004)
(-74.022864, 40.645338)
(-74.008398, 40.721073)
(-73.95564, 40.814215999999995)
(-73.835629, 40.767332)
(-73.944214, 40.740811)
(-73.93931500000002, 40.750561)
(-73.93931500000002, 40.750561)
(-73.996421, 40.667573)
(-74.014333, 40.652989)
(-73.876414, 40.805254999999995)
(-73.876414, 40.805254999999995)
(-73.92605999999998, 40.762301)
(-73.89970500000003, 40.695116999999996)
(-73.956819, 40.679518)
(-73.88925400000002, 40.810408)
(-73.946224, 40.750018)
(-73.752361, 40.660713)
(-73.904993, 40.676026)
(-73.894885, 40.735419)
(-73.941179, 40.753347999999995)
(-73.92375600000003, 40.757169)
(-73.910602, 40.8274)
(-73.882787, 40.705753)
(-73.752361, 40.660713)
(-74.015287, 40.650686)
(-73.934086, 40.739456)
(-73.899225, 40.84291500000001)
(-74.000588, 40.662023)
(-73.953835, 40.723859000000004)
(-74.022864, 40.645338)
(-73.929583, 40.745615)
(-73.90894200000002, 40.720275)
(-73.73326800000002, 40.717665999999994)
(-74.00416700000002, 40.669944)
(-74.011266, 40.674138)
(-73.93931500000002, 40.750561)
(-73.933112, 40.746311)
(-73.876414, 40.805254999999995)
(-73.935676, 40.755741)
(-73.74373, 40.715576)
(-73.876414, 40.805254999999995)
(-73.936464, 40.636352)
(-73.901049, 40.836774)
(-73.992959, 40.673125)
(-73.920288, 40.711028000000006)
(-73.876414, 40.805254999999995)
(-73.90521, 40.673119)
(-73.946326, 40.752423)
(-73.819012, 40.587548999999996)
(-73.819012, 40.587548999999996)
(-73.865661, 40.742133)
(-73.929902, 40.86770900000001)
(-74.012149, 40.656264)
(-73.953709, 40.723636)
(-73.896996, 40.774784000000004)
(-73.928728, 40.755140999999995)
(-73.93119, 40.716288)
(-73.93119, 40.716288)
(-73.886381, 40.806838)
(-73.956074, 40.743117)
(-73.91990899999998, 40.722716999999996)
(-73.959375, 40.733325)
(-73.929441, 40.74637)
(-73.907159, 40.808975)
(-73.852626, 40.900509)
(-74.013511, 40.652366)
(-73.84298299999998, 40.836141)
(-73.887436, 40.810790999999995)
(-73.932704, 40.738818)
(-73.932704, 40.738818)
(-73.955442, 40.738162)
(-73.907647, 40.751015)
(-73.9447, 40.729399)
(-73.852722, 40.783961)
(-73.876414, 40.805254999999995)
(-73.927176, 40.709254)
(-73.880481, 40.879884999999994)
(-73.880481, 40.879884999999994)
(-73.876414, 40.805254999999995)
(-73.876414, 40.805254999999995)
(-73.912366, 40.64599000000001)
(-73.946342, 40.750979)
(-74.022864, 40.645338)
(-73.90975300000002, 40.80576)
(-73.760553, 40.684039)
(-73.95375899999998, 40.812964)
(-73.93044300000003, 40.740573)
(-73.992742, 40.754384)
(-73.952259, 40.74815200000001)
(-73.932177, 40.742253999999996)
(-74.179839, 40.614257)
(-73.908261, 40.719590999999994)
(-73.937444, 40.76354)
(-73.94279499999998, 40.758311)
(-73.93118299999998, 40.705732)
(-73.914052, 40.718879)
(-73.914052, 40.718879)
(-74.017362, 40.647523)
(-73.82895, 40.890837)
(-73.937497, 40.741403999999996)
(-73.93571, 40.705224)
(-73.91314100000002, 40.614785)
(-73.920406, 40.708997)
(-73.910449, 40.715813)
(-73.774827, 40.758874)
(-73.95506800000003, 40.80599)
(-73.775743, 40.680671999999994)
(-73.949065, 40.749237)
(-73.899078, 40.673120000000004)
(-74.01003299999998, 40.652078)
(-73.933105, 40.742362)
(-73.892928, 40.812578)
(-73.915485, 40.800887)
(-73.946078, 40.729518)
(-73.911722, 40.650059999999996)
(-73.942228, 40.7539)
(-73.941179, 40.753347999999995)
(-74.010563, 40.654362)
(-73.934949, 40.727108)
(-73.93865799999998, 40.755177)
(-73.99244499999998, 40.693513)
(-73.988539, 40.742976)
(-73.85469300000003, 40.783871999999995)
(-73.900754, 40.840243)
(-73.933112, 40.746311)
(-73.987227, 40.693463)
(-73.90242099999998, 40.753777)
(-74.009845, 40.673726)
(-73.844836, 40.785114)
(-73.91548399999998, 40.801741)
(-73.949742, 40.741017)
(-73.927495, 40.624619)
(-73.817697, 40.696202)
(-74.01183499999998, 40.674656)
(-73.93784699999998, 40.742367)
(-74.008204, 40.722201)
(-73.97632, 40.627705)
(-73.935652, 40.74306)
(-73.93784699999998, 40.742367)
(-74.137002, 40.64015300000001)
(-73.921839, 40.717441)
(-73.908282, 40.719945)
(-73.90468100000002, 40.770681)
(-73.926239, 40.727687)
(-73.98029100000002, 40.639511)
(-73.94060400000002, 40.802879)
(-73.95564, 40.814215999999995)
(-73.98971800000002, 40.725775)
(-73.93602800000002, 40.716124)
(-73.906774, 40.75080300000001)
(-74.022864, 40.645338)
(-73.928782, 40.813086)
(-73.938738, 40.800767)
(-73.975548, 40.760184)
(-73.809977, 40.700846999999996)
(-73.912454, 40.724584)
(-73.93338100000003, 40.707583)
(-73.992126, 40.676621999999995)
(-73.907831, 40.652577)
(-73.90843199999998, 40.653192)
(-73.996861, 40.659786)
(-73.909345, 40.800542)
(-73.98484300000001, 40.75886)
(-73.84764799999998, 40.773145)
(-73.931946, 40.742636)
(-73.942228, 40.7539)
(-73.939886, 40.757754999999996)
(-74.01462099999998, 40.654778)
(-73.926041, 40.714043)
(-73.908243, 40.719294)
(-73.950972, 40.750997999999996)
(-73.940892, 40.726858)
(-73.962846, 40.707056)
(-73.936953, 40.718136)
(-74.022864, 40.645338)
(-73.92706, 40.811966999999996)
(-73.943635, 40.751055)
(-73.943635, 40.751055)
(-73.955442, 40.738162)
(-74.01764, 40.64839600000001)
(-73.838406, 40.842742)
(-73.949065, 40.74924)
(-73.928609, 40.812078)
(-73.935652, 40.74306)
(-73.894458, 40.674713)
(-73.876414, 40.805254999999995)
(-73.949742, 40.741017)
(-73.941179, 40.753347999999995)
(-73.956819, 40.679518)
(-73.948819, 40.753496999999996)
(-74.014491, 40.653082)
(-73.842107, 40.835001)
(-73.91279300000002, 40.644245)
(-73.944418, 40.729409999999994)
(-73.94202299999998, 40.758036)
(-73.935794, 40.715618)
(-73.928728, 40.755140999999995)
(-73.932789, 40.737041999999995)
(-73.977728, 40.685093)
(-73.95375899999998, 40.812964)
(-73.905711, 40.650042)
(-73.925887, 40.752096)
(-73.88465, 40.811156)
(-73.88465, 40.811156)
(-73.876414, 40.805254999999995)
(-73.938696, 40.705403999999994)
(-73.912363, 40.754919)
(-73.876414, 40.805254999999995)
(-73.946394, 40.749458000000004)
(-73.949742, 40.741017)
(-73.82775500000002, 40.757519)
(-73.83160500000002, 40.762384999999995)
(-73.876414, 40.805254999999995)
(-73.935652, 40.74306)
(-73.991835, 40.672715999999994)
(-73.874732, 40.660379)
(-74.014227, 40.679182)
(-73.88513499999998, 40.819218)
(-73.80693199999997, 40.794553)
(-73.825684, 40.886821999999995)
(-73.938748, 40.708275)
(-73.938696, 40.705403999999994)
(-74.016468, 40.676198)
(-74.022864, 40.645338)
(-73.983303, 40.683921999999995)
(-74.022864, 40.645338)
(-73.94014, 40.744454)
(-73.842448, 40.837532)
(-73.842448, 40.837532)
(-73.943731, 40.748206)
(-73.987227, 40.693463)
(-73.95375899999998, 40.812964)
(-74.022864, 40.645338)
(-73.992253, 40.673968)
(-74.016249, 40.64776)
(-73.891527, 40.811574)
(-73.838373, 40.842733)
(-74.200825, 40.586217)
(-74.022864, 40.645338)
(-73.987714, 40.691596999999994)
(-73.909345, 40.800542)
(-73.92459699999998, 40.753432000000004)
(-74.14348000000003, 40.638163)
(-73.896413, 40.776128)
(-73.840986, 40.835524)
(-73.89707800000002, 40.656048)
(-73.920396, 40.7233)
(-73.91899000000002, 40.713695)
(-73.95375899999998, 40.812964)
(-74.00668399999998, 40.680349)
(-73.898971, 40.779751)
(-74.022864, 40.645338)
(-73.93302800000002, 40.753928)
(-74.009925, 40.653997)
(-73.876414, 40.805254999999995)
(-73.932148, 40.742385999999996)
(-73.93601, 40.704425)
(-73.843777, 40.688681)
(-73.956819, 40.679518)
(-74.151034, 40.632925)
/home/user/.virtualenvs/crosscompute/lib/python3.6/site-packages/geopandas/geodataframe.py:65: UserWarning: Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access
  super(GeoDataFrame, self).__setattr__(attr, val)
In [13]:
gdf.Coordinate[0]
Out[13]:
-74.151034
In [14]:
gdf.Coordinate[1]
Out[14]:
40.632925
In [15]:
len(gdf.Coordinate)
Out[15]:
2
In [16]:
for j in gdf.geometry:
    pt1 = user_coor
    pt2 = j
    dist = geopy.distance.distance(pt1, pt2).miles
    print(dist)
#print(gdf.Coordinate)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/.virtualenvs/crosscompute/lib/python3.6/site-packages/geopy/point.py in __new__(cls, latitude, longitude, altitude)
    158                 try:
--> 159                     seq = iter(arg)
    160                 except TypeError:

TypeError: 'Point' object is not iterable

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-16-64af815d91db> in <module>
      2     pt1 = user_coor
      3     pt2 = j
----> 4     dist = geopy.distance.distance(pt1, pt2).miles
      5     print(dist)
      6 #print(gdf.Coordinate)

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/geopy/distance.py in __init__(self, *args, **kwargs)
    387         kwargs.pop('iterations', 0)
    388         major, minor, f = self.ELLIPSOID
--> 389         super(geodesic, self).__init__(*args, **kwargs)
    390 
    391     def set_ellipsoid(self, ellipsoid):

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/geopy/distance.py in __init__(self, *args, **kwargs)
    162         elif len(args) > 1:
    163             for a, b in util.pairwise(args):
--> 164                 kilometers += self.measure(a, b)
    165 
    166         kilometers += units.kilometers(**kwargs)

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/geopy/distance.py in measure(self, a, b)
    408     # Call geographiclib routines for measure and destination
    409     def measure(self, a, b):
--> 410         a, b = Point(a), Point(b)
    411         lat1, lon1 = a.latitude, a.longitude
    412         lat2, lon2 = b.latitude, b.longitude

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/geopy/point.py in __new__(cls, latitude, longitude, altitude)
    160                 except TypeError:
    161                     raise TypeError(
--> 162                         "Failed to create Point instance from %r." % (arg,)
    163                     )
    164                 else:

TypeError: Failed to create Point instance from <shapely.geometry.point.Point object at 0x7f2cf8cd4c88>.
In [17]:
for i in gdf.geometry:
    print(i)
POINT (-73.929565 40.745706)
POINT (-74.150999 40.633153)
POINT (-73.84483299999999 40.785144)
POINT (-74.00230000000001 40.673106)
POINT (-73.932148 40.742386)
POINT (-73.995088 40.746364)
POINT (-73.889346 40.676789)
POINT (-73.931466 40.745811)
POINT (-73.87113199999997 40.665766)
POINT (-73.896804 40.77494)
POINT (-73.94949699999999 40.74551)
POINT (-73.862139 40.707402)
POINT (-73.932208 40.716031)
POINT (-73.963076 40.715227)
POINT (-73.900755 40.779184)
POINT (-73.839512 40.676351)
POINT (-73.982725 40.65943)
POINT (-73.846811 40.720892)
POINT (-73.89980300000001 40.752183)
POINT (-73.95654 40.72499000000001)
POINT (-73.888513 40.80819)
POINT (-73.936863 40.698747)
POINT (-73.83452700000002 40.786469)
POINT (-73.95375899999998 40.812964)
POINT (-73.900288 40.654623)
POINT (-73.986681 40.702763)
POINT (-73.95375899999998 40.812964)
POINT (-73.997405 40.660096)
POINT (-73.846583 40.848176)
POINT (-73.956819 40.679518)
POINT (-73.89206800000002 40.810008)
POINT (-73.92214799999998 40.730657)
POINT (-73.939362 40.762075)
POINT (-73.952145 40.656131)
POINT (-74.022864 40.645338)
POINT (-73.951224 40.74805300000001)
POINT (-73.958833 40.722996)
POINT (-73.93324 40.740913)
POINT (-73.92872800000001 40.75514099999999)
POINT (-73.801885 40.696796)
POINT (-73.985741 40.694059)
POINT (-73.93158000000003 40.740357)
POINT (-73.934421 40.710477)
POINT (-73.75236099999999 40.660713)
POINT (-73.93656800000002 40.743168)
POINT (-74.02484100000002 40.64102800000001)
POINT (-73.860861 40.744199)
POINT (-73.90329799999998 40.810912)
POINT (-73.996897 40.662525)
POINT (-73.913146 40.716759)
POINT (-73.932182 40.740775)
POINT (-73.764972 40.681323)
POINT (-73.92326800000002 40.706817)
POINT (-73.951224 40.74805300000001)
POINT (-73.98245899999998 40.640848)
POINT (-73.925887 40.752096)
POINT (-73.93216700000001 40.742197)
POINT (-73.95564 40.81421599999999)
POINT (-74.022864 40.645338)
POINT (-73.90329399999997 40.649894)
POINT (-73.872648 40.809733)
POINT (-73.98344300000002 40.581105)
POINT (-73.946282 40.74942)
POINT (-73.901399 40.695815)
POINT (-74.014866 40.65331)
POINT (-73.89773100000002 40.670294)
POINT (-74.022864 40.645338)
POINT (-73.945972 40.748624)
POINT (-74.022864 40.645338)
POINT (-73.926734 40.711043)
POINT (-73.81868900000001 40.695926)
POINT (-74.022864 40.645338)
POINT (-74.022864 40.645338)
POINT (-73.876414 40.805255)
POINT (-73.933981 40.742598)
POINT (-73.956819 40.679518)
POINT (-73.932148 40.742386)
POINT (-73.932148 40.742386)
POINT (-73.977306 40.631548)
POINT (-73.956819 40.679518)
POINT (-74.022864 40.645338)
POINT (-73.876414 40.805255)
POINT (-74.003916 40.681593)
POINT (-73.990577 40.693445)
POINT (-73.98486800000001 40.680538)
POINT (-73.942538 40.742724)
POINT (-73.93751400000002 40.743281)
POINT (-73.99797099999998 40.665937)
POINT (-73.90517800000001 40.650211)
POINT (-74.010851 40.652712)
POINT (-73.932148 40.742386)
POINT (-73.88514000000001 40.805769)
POINT (-73.876414 40.805255)
POINT (-73.99367700000001 40.670218)
POINT (-73.925887 40.752096)
POINT (-73.907629 40.80337100000001)
POINT (-73.886166 40.822381)
POINT (-74.006109 40.654403)
POINT (-73.82892700000002 40.784639)
POINT (-73.925141 40.71587)
POINT (-73.931265 40.741954)
POINT (-73.90163800000001 40.84177800000001)
POINT (-73.937833 40.741426)
POINT (-73.830545 40.71513)
POINT (-74.00814799999998 40.682405)
POINT (-73.933139 40.740902)
POINT (-73.95564 40.81421599999999)
POINT (-73.950738 40.736286)
POINT (-73.87187 40.804854)
POINT (-73.953709 40.723636)
POINT (-73.951216 40.748069)
POINT (-73.775424 40.662029)
POINT (-73.920956 40.771363)
POINT (-73.943731 40.748206)
POINT (-73.93751400000002 40.743281)
POINT (-73.961625 40.698242)
POINT (-73.90683900000001 40.673568)
POINT (-73.90683900000001 40.673568)
POINT (-74.015629 40.649234)
POINT (-73.935833 40.757018)
POINT (-73.95446800000001 40.695654)
POINT (-73.864953 40.708643)
POINT (-73.87772199999998 40.66150800000001)
POINT (-73.949285 40.748483)
POINT (-74.01657400000001 40.65163)
POINT (-74.02272099999998 40.646985)
POINT (-73.876414 40.805255)
POINT (-74.022864 40.645338)
POINT (-73.82775500000002 40.757519)
POINT (-73.935652 40.74306)
POINT (-73.917486 40.739689)
POINT (-74.022864 40.645338)
POINT (-73.87369100000002 40.810305)
POINT (-73.935652 40.74306)
POINT (-73.91586700000001 40.750033)
POINT (-74.022864 40.645338)
POINT (-73.854823 40.785665)
POINT (-73.89293000000001 40.676158)
POINT (-73.908265 40.805545)
POINT (-74.01571199999999 40.678254)
POINT (-74.022864 40.645338)
POINT (-73.936048 40.755514)
POINT (-73.94804499999999 40.728643)
POINT (-73.99833100000002 40.666156)
POINT (-73.774736 40.70463400000001)
POINT (-73.73167099999998 40.718175)
POINT (-73.88643499999998 40.806967)
POINT (-74.017003 40.652459)
POINT (-73.953622 40.812887)
POINT (-73.907201 40.802237)
POINT (-73.759058 40.681472)
POINT (-73.901421 40.719695)
POINT (-73.91429100000001 40.726479)
POINT (-73.91429100000001 40.726479)
POINT (-73.949225 40.74692899999999)
POINT (-73.900999 40.671139)
POINT (-73.845843 40.766816)
POINT (-73.932261 40.741725)
POINT (-73.926553 40.753743)
POINT (-73.94170600000002 40.753148)
POINT (-73.99754899999998 40.66568400000001)
POINT (-73.987898 40.73520300000001)
POINT (-73.876414 40.805255)
POINT (-73.949282 40.748483)
POINT (-73.89556 40.773816)
POINT (-73.89556 40.773816)
POINT (-73.930409 40.708045)
POINT (-73.746684 40.666407)
POINT (-73.967512 40.701526)
POINT (-73.949701 40.748206)
POINT (-74.022864 40.645338)
POINT (-73.876414 40.805255)
POINT (-73.906015 40.805184)
POINT (-73.99162800000001 40.623705)
POINT (-73.940568 40.802929)
POINT (-73.935968 40.740233)
POINT (-73.928747 40.636521)
POINT (-73.928747 40.636521)
POINT (-73.938484 40.704687)
POINT (-73.998209 40.665231)
POINT (-73.998209 40.665231)
POINT (-73.998209 40.665231)
POINT (-73.908282 40.719945)
POINT (-73.876414 40.805255)
POINT (-74.23074 40.537235)
POINT (-73.91790400000002 40.643104)
POINT (-73.99086899999998 40.695201)
POINT (-73.95544200000001 40.738162)
POINT (-73.876414 40.805255)
POINT (-74.004183 40.684708)
POINT (-73.949065 40.749237)
POINT (-73.947213 40.739918)
POINT (-74.022864 40.645338)
POINT (-73.903566 40.76524600000001)
POINT (-73.876414 40.805255)
POINT (-73.94098699999998 40.802355)
POINT (-73.925887 40.752096)
POINT (-74.00223299999998 40.717634)
POINT (-73.86009799999999 40.897944)
POINT (-74.182637 40.633645)
POINT (-73.876414 40.805255)
POINT (-73.98924599999999 40.675669)
POINT (-74.002999 40.752098)
POINT (-73.779302 40.665363)
POINT (-73.894052 40.814074)
POINT (-73.95375899999998 40.812964)
POINT (-73.935824 40.740189)
POINT (-73.925887 40.752096)
POINT (-73.944744 40.732015)
POINT (-73.950677 40.735569)
POINT (-73.897862 40.775199)
POINT (-73.907348 40.660193)
POINT (-73.935652 40.74306)
POINT (-74.004713 40.741876)
POINT (-73.966663 40.6972)
POINT (-73.966663 40.6972)
POINT (-73.929199 40.675741)
POINT (-73.888274 40.806719)
POINT (-73.93594499999998 40.749656)
POINT (-73.798233 40.761017)
POINT (-73.842191 40.852806)
POINT (-73.961816 40.697278)
POINT (-73.914625 40.727923)
POINT (-73.997675 40.666626)
POINT (-74.01613 40.676489)
POINT (-73.918986 40.802366)
POINT (-73.92793399999999 40.711376)
POINT (-73.954391 40.812648)
POINT (-73.931112 40.746728)
POINT (-73.919543 40.721144)
POINT (-73.947563 40.836017)
POINT (-73.925887 40.752096)
POINT (-73.75236099999999 40.660713)
POINT (-73.956819 40.679518)
POINT (-73.951224 40.74805300000001)
POINT (-74.022864 40.645338)
POINT (-73.948587 40.750848)
POINT (-73.844459 40.830846)
POINT (-73.94580000000001 40.751745)
POINT (-73.821995 40.699206)
POINT (-73.77622 40.701945)
POINT (-73.93678199999999 40.742839)
POINT (-74.022864 40.645338)
POINT (-74.008398 40.721073)
POINT (-73.95564 40.81421599999999)
POINT (-73.835629 40.767332)
POINT (-73.944214 40.740811)
POINT (-73.93931500000002 40.750561)
POINT (-73.93931500000002 40.750561)
POINT (-73.996421 40.667573)
POINT (-74.01433299999999 40.652989)
POINT (-73.876414 40.805255)
POINT (-73.876414 40.805255)
POINT (-73.92605999999998 40.762301)
POINT (-73.89970500000003 40.695117)
POINT (-73.956819 40.679518)
POINT (-73.88925400000002 40.810408)
POINT (-73.946224 40.750018)
POINT (-73.75236099999999 40.660713)
POINT (-73.904993 40.676026)
POINT (-73.894885 40.735419)
POINT (-73.94117900000001 40.753348)
POINT (-73.92375600000003 40.757169)
POINT (-73.910602 40.8274)
POINT (-73.88278699999999 40.705753)
POINT (-73.75236099999999 40.660713)
POINT (-74.015287 40.650686)
POINT (-73.93408599999999 40.739456)
POINT (-73.899225 40.84291500000001)
POINT (-74.00058799999999 40.662023)
POINT (-73.953835 40.723859)
POINT (-74.022864 40.645338)
POINT (-73.92958299999999 40.745615)
POINT (-73.90894200000002 40.720275)
POINT (-73.73326800000002 40.71766599999999)
POINT (-74.00416700000002 40.669944)
POINT (-74.01126600000001 40.674138)
POINT (-73.93931500000002 40.750561)
POINT (-73.93311199999999 40.746311)
POINT (-73.876414 40.805255)
POINT (-73.935676 40.755741)
POINT (-73.74373 40.715576)
POINT (-73.876414 40.805255)
POINT (-73.936464 40.636352)
POINT (-73.901049 40.836774)
POINT (-73.992959 40.673125)
POINT (-73.920288 40.71102800000001)
POINT (-73.876414 40.805255)
POINT (-73.90521 40.673119)
POINT (-73.946326 40.752423)
POINT (-73.819012 40.587549)
POINT (-73.819012 40.587549)
POINT (-73.865661 40.742133)
POINT (-73.929902 40.86770900000001)
POINT (-74.01214899999999 40.656264)
POINT (-73.953709 40.723636)
POINT (-73.896996 40.774784)
POINT (-73.92872800000001 40.75514099999999)
POINT (-73.93119 40.716288)
POINT (-73.93119 40.716288)
POINT (-73.886381 40.806838)
POINT (-73.956074 40.743117)
POINT (-73.91990899999998 40.722717)
POINT (-73.95937499999999 40.733325)
POINT (-73.929441 40.74637)
POINT (-73.90715899999999 40.808975)
POINT (-73.852626 40.900509)
POINT (-74.01351099999999 40.652366)
POINT (-73.84298299999998 40.836141)
POINT (-73.88743599999999 40.81079099999999)
POINT (-73.932704 40.738818)
POINT (-73.932704 40.738818)
POINT (-73.95544200000001 40.738162)
POINT (-73.907647 40.751015)
POINT (-73.9447 40.729399)
POINT (-73.852722 40.783961)
POINT (-73.876414 40.805255)
POINT (-73.927176 40.709254)
POINT (-73.880481 40.87988499999999)
POINT (-73.880481 40.87988499999999)
POINT (-73.876414 40.805255)
POINT (-73.876414 40.805255)
POINT (-73.91236600000001 40.64599000000001)
POINT (-73.946342 40.750979)
POINT (-74.022864 40.645338)
POINT (-73.90975300000002 40.80576)
POINT (-73.760553 40.684039)
POINT (-73.95375899999998 40.812964)
POINT (-73.93044300000003 40.740573)
POINT (-73.99274200000001 40.754384)
POINT (-73.952259 40.74815200000001)
POINT (-73.932177 40.742254)
POINT (-74.179839 40.614257)
POINT (-73.908261 40.71959099999999)
POINT (-73.937444 40.76354)
POINT (-73.94279499999998 40.758311)
POINT (-73.93118299999998 40.705732)
POINT (-73.914052 40.718879)
POINT (-73.914052 40.718879)
POINT (-74.01736200000001 40.647523)
POINT (-73.82895000000001 40.890837)
POINT (-73.93749699999999 40.741404)
POINT (-73.93571 40.705224)
POINT (-73.91314100000002 40.614785)
POINT (-73.920406 40.708997)
POINT (-73.910449 40.715813)
POINT (-73.774827 40.758874)
POINT (-73.95506800000003 40.80599)
POINT (-73.77574300000001 40.68067199999999)
POINT (-73.949065 40.749237)
POINT (-73.899078 40.67312)
POINT (-74.01003299999998 40.652078)
POINT (-73.933105 40.742362)
POINT (-73.892928 40.812578)
POINT (-73.915485 40.800887)
POINT (-73.946078 40.729518)
POINT (-73.911722 40.65006)
POINT (-73.942228 40.7539)
POINT (-73.94117900000001 40.753348)
POINT (-74.010563 40.654362)
POINT (-73.934949 40.727108)
POINT (-73.93865799999998 40.755177)
POINT (-73.99244499999998 40.693513)
POINT (-73.988539 40.742976)
POINT (-73.85469300000003 40.783872)
POINT (-73.90075400000001 40.840243)
POINT (-73.93311199999999 40.746311)
POINT (-73.987227 40.693463)
POINT (-73.90242099999998 40.753777)
POINT (-74.009845 40.673726)
POINT (-73.844836 40.785114)
POINT (-73.91548399999998 40.801741)
POINT (-73.949742 40.741017)
POINT (-73.92749499999999 40.624619)
POINT (-73.817697 40.696202)
POINT (-74.01183499999998 40.674656)
POINT (-73.93784699999998 40.742367)
POINT (-74.00820400000001 40.722201)
POINT (-73.97632 40.627705)
POINT (-73.935652 40.74306)
POINT (-73.93784699999998 40.742367)
POINT (-74.137002 40.64015300000001)
POINT (-73.92183900000001 40.717441)
POINT (-73.908282 40.719945)
POINT (-73.90468100000002 40.770681)
POINT (-73.926239 40.727687)
POINT (-73.98029100000002 40.639511)
POINT (-73.94060400000002 40.802879)
POINT (-73.95564 40.81421599999999)
POINT (-73.98971800000002 40.725775)
POINT (-73.93602800000002 40.716124)
POINT (-73.906774 40.75080300000001)
POINT (-74.022864 40.645338)
POINT (-73.928782 40.813086)
POINT (-73.938738 40.800767)
POINT (-73.975548 40.760184)
POINT (-73.809977 40.700847)
POINT (-73.912454 40.724584)
POINT (-73.93338100000003 40.707583)
POINT (-73.992126 40.67662199999999)
POINT (-73.907831 40.652577)
POINT (-73.90843199999998 40.653192)
POINT (-73.996861 40.659786)
POINT (-73.909345 40.800542)
POINT (-73.98484300000001 40.75886)
POINT (-73.84764799999998 40.773145)
POINT (-73.931946 40.742636)
POINT (-73.942228 40.7539)
POINT (-73.939886 40.757755)
POINT (-74.01462099999998 40.654778)
POINT (-73.926041 40.714043)
POINT (-73.908243 40.719294)
POINT (-73.95097199999999 40.750998)
POINT (-73.94089200000001 40.726858)
POINT (-73.962846 40.707056)
POINT (-73.936953 40.718136)
POINT (-74.022864 40.645338)
POINT (-73.92706 40.811967)
POINT (-73.943635 40.751055)
POINT (-73.943635 40.751055)
POINT (-73.95544200000001 40.738162)
POINT (-74.01764 40.64839600000001)
POINT (-73.83840600000001 40.842742)
POINT (-73.949065 40.74924)
POINT (-73.92860899999999 40.812078)
POINT (-73.935652 40.74306)
POINT (-73.894458 40.674713)
POINT (-73.876414 40.805255)
POINT (-73.949742 40.741017)
POINT (-73.94117900000001 40.753348)
POINT (-73.956819 40.679518)
POINT (-73.948819 40.753497)
POINT (-74.01449100000001 40.653082)
POINT (-73.842107 40.835001)
POINT (-73.91279300000002 40.644245)
POINT (-73.944418 40.72940999999999)
POINT (-73.94202299999998 40.758036)
POINT (-73.935794 40.715618)
POINT (-73.92872800000001 40.75514099999999)
POINT (-73.932789 40.737042)
POINT (-73.977728 40.685093)
POINT (-73.95375899999998 40.812964)
POINT (-73.905711 40.650042)
POINT (-73.925887 40.752096)
POINT (-73.88464999999999 40.811156)
POINT (-73.88464999999999 40.811156)
POINT (-73.876414 40.805255)
POINT (-73.93869599999999 40.70540399999999)
POINT (-73.912363 40.754919)
POINT (-73.876414 40.805255)
POINT (-73.946394 40.749458)
POINT (-73.949742 40.741017)
POINT (-73.82775500000002 40.757519)
POINT (-73.83160500000002 40.76238499999999)
POINT (-73.876414 40.805255)
POINT (-73.935652 40.74306)
POINT (-73.99183499999999 40.67271599999999)
POINT (-73.87473199999999 40.660379)
POINT (-74.01422700000001 40.679182)
POINT (-73.88513499999998 40.819218)
POINT (-73.80693199999997 40.794553)
POINT (-73.825684 40.886822)
POINT (-73.938748 40.708275)
POINT (-73.93869599999999 40.70540399999999)
POINT (-74.016468 40.676198)
POINT (-74.022864 40.645338)
POINT (-73.98330300000001 40.683922)
POINT (-74.022864 40.645338)
POINT (-73.94014 40.744454)
POINT (-73.842448 40.837532)
POINT (-73.842448 40.837532)
POINT (-73.943731 40.748206)
POINT (-73.987227 40.693463)
POINT (-73.95375899999998 40.812964)
POINT (-74.022864 40.645338)
POINT (-73.99225300000001 40.673968)
POINT (-74.016249 40.64776)
POINT (-73.891527 40.811574)
POINT (-73.838373 40.842733)
POINT (-74.20082499999999 40.586217)
POINT (-74.022864 40.645338)
POINT (-73.987714 40.69159699999999)
POINT (-73.909345 40.800542)
POINT (-73.92459699999998 40.753432)
POINT (-74.14348000000003 40.638163)
POINT (-73.896413 40.776128)
POINT (-73.840986 40.835524)
POINT (-73.89707800000002 40.656048)
POINT (-73.920396 40.7233)
POINT (-73.91899000000002 40.713695)
POINT (-73.95375899999998 40.812964)
POINT (-74.00668399999998 40.680349)
POINT (-73.898971 40.779751)
POINT (-74.022864 40.645338)
POINT (-73.93302800000002 40.753928)
POINT (-74.009925 40.653997)
POINT (-73.876414 40.805255)
POINT (-73.932148 40.742386)
POINT (-73.93601 40.704425)
POINT (-73.843777 40.688681)
POINT (-73.956819 40.679518)
POINT (-74.151034 40.632925)
In [18]:
type(ref_coor)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-18-df8c669768cc> in <module>
----> 1 type(ref_coor)

NameError: name 'ref_coor' is not defined
In [19]:
# Save your output files in target_folder
target_path = target_folder + '/Ready table with geometry points.csv'
gdf.to_csv(target_path, index=False)

# Render the file as a table
print('final_table_path = %s' % target_path)
final_table_path = /tmp/Ready table with geometry points.csv
In [20]:
gdf.to_csv('Ready table with geometry points.csv', sep=',')
In [ ]: