蟒蛇新手。我在 python 中使用 pygeocodio 库
API_KEY = "myapikey"
from geocodio import GeocodioClient
client = GeocodioClient(API_KEY)
addresses = client.geocode("21236 Birchwood Loop, 99567, AK")
addresses.best_match.get("accuracy")
Out[61]: 1
addresses.best_match.get("accuracy_type")
Out[62]: 'rooftop'
但是,如果我想遍历数据框(example.csv):
import pandas as pd
customers = pd.read_csv("example.csv")
for row in customers.iterrows():
addresses = client.geocode(row)
addresses.best_match.get("accuracy")
我收到一个错误:
File "C:\Users\jtharian\AppData\Local\Continuum\anaconda3\lib\site-packages\geocodio\client.py", line 58, in error_response
raise exceptions.GeocodioDataError(response.json()["error"])
GeocodioDataError: Could not geocode address. Postal code or city required.
example.csv 的代表:
21236 Birchwood Loop, 99567, AK
1731 Bragaw St, 99508, AK
300 E Fireweed Ln, 99503, AK
4360 Snider Dr, 99654, AK
1921 W Dimond Blvd 108, 99515, AK
2702 Peger Rd, 99709, AK
1651 College Rd, 99709, AK
898 Ballaine Rd, 99709, AK
23819 Immelman Circle, 99567, AK
9750 W Parks Hwy, 99652, AK
7205 Shorewood Dr, 99645, AK
为什么我会收到此错误?