【问题标题】:HTTP Error 500 using Python's geopy + Google Maps Geocoding API使用 Python 的 geopy + Google Maps Geocoding API 的 HTTP 错误 500
【发布时间】:2017-09-05 20:14:44
【问题描述】:

所以,我正在尝试通过 geopy 使用 Google Maps Geocoding API 对 Pandas df 上的列进行地理编码,并继续将其作为输出:

GeocoderServiceError:HTTP 错误 500:内部服务器错误

昨天,我在稍小的 df 上使用了相同的代码,它运行良好。

import pandas as pd
from geopy import geocoders
df = pd.read_csv('file.csv')

g = geocoders.GoogleV3(api_key="APIKEY")

df["Coordinates"]=df["GEO"].apply(g.geocode, timeout=50)
df["Latitude"]=df["Coordinates"].apply(lambda x: x.latitude if x != None else None)
df["Longitude"]=df["Coordinates"].apply(lambda x: x.longitude if x != None else None)

“地理位置”是包含完整地址的列。

【问题讨论】:

    标签: python pandas geocoding google-geocoding-api geopy


    【解决方案1】:

    所以,事实证明我没有找到专门解决此问题的方法。我不得不绕过它并处理错误。

    以这段代码为例: https://github.com/woosmap/samples/tree/master/python-samples/batchgeocoding

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-27
      • 2017-04-21
      • 2017-08-17
      • 1970-01-01
      • 1970-01-01
      • 2016-07-18
      • 2019-11-05
      • 1970-01-01
      相关资源
      最近更新 更多