【发布时间】:2017-11-09 22:55:22
【问题描述】:
我在 excel 中有帖子编号的数据。我在 python 中输入作为列表。 我使用地理编码器库通过帖子编号获取纬度和经度,以便我稍后可以将其放在地图上。
g = geocoder.google('1700002')
g.latlng
g.latlng 给我带来了一个列表,其中包含 [纬度,经度]。 因为只取字符串。我将值从 float 更改为 int 以摆脱点 0 (133.0 = 130)。然后把它变成字符串来读取它。
yubin_frame = yubin['yubin'] #post data
#1st put it to ing to get rid of float
yubin_list_int = map(int, yubin_list)
#then make it to string to in put all to string
yubin_list_str = map(str, yubin_list_int)
我做了这个for循环来制作这样的纬度和经度列表。
#create a new list that include all data in Yubin_zahyou list
Yubin_zahyou = []
for i in range(len(yubin_list_str)):
Yubin_zahyou.append(geocoder.google(yubin_list_str[i]).latlng)
我的问题是我有近 30000 个数据,而地理编码器只带来近 2500 个输入!这是否意味着地理编码器有限制或我犯了某种错误?
【问题讨论】:
标签: python google-maps for-loop google-geocoder