enter code here
嗨,
我想保存一些通过地理代码提取的坐标(纬度和经度),问题是这些坐标没有保存,我似乎无法将它们作为列添加到我使用pandas生成的表中
我得到这个错误: AttributeError:'NoneType'对象没有属性'latitude'
import pandas
from geopy.geocoders import Nominatim
df1= pandas.read_json("supermarkets.json")
nom= Nominatim(scheme= 'http')
lis= list(df1.index)
for i in lis:
l= nom.geocode(list(df1.loc[i,"Address":"Country"]))
j=[]+ [l.latitude]
k=[]+ [l.longitude]
我希望有一种方法可以保存坐标并将它们包含在我的表中。谢谢
如果地址找不到,^{} [geopy-doc]可能会导致
None
,或者查询没有在足够的时间内得到回答。文件中规定了这一点:我们首先查询所有位置,然后检查成功的位置,并检索该位置的
latitude
和latitude
。你知道吗相关问题 更多 >
编程相关推荐