这是我试图运行的代码,但我没有得到输出中的值,
import numpy
import geocoder
data = numpy.loadtxt(fname = 'Flywheel_SF.csv', delimiter = ',', dtype = numpy.ndarray)
start = list()
end = list()
z_code = numpy.zeros((101,2))
for i in range(1,101):
s = geocoder.google([data[i,4], data[i,5]], method='reverse')
e = geocoder.google([data[i,6], data[i,7]], method='reverse')
start.append(s.postal)
end.append(e.postal)
z_code[i,0] = s.postal
z_code[i,1] = e.postal
zipcode = [start, end]
print(z_code)
这是我得到的输出,
[[ 0. 0.]
[ nan nan]
[ nan nan]
[ nan nan]
[ nan nan]
....
....
[ nan nan]
[ nan nan]
[ nan nan]
[ nan nan]
[ nan nan]
[ nan nan]]
输出应该是这样的,这些是从纬度和经度转换的zipcode
[[ 0. 0.]
[ 94105. 94103.]
[ 94133. 94108.]
[ 94133. 94133.]
[ 94114. 94122.]
[ 94104. 94128.]
[ 94128. 94066.]
......
......
[ 94128. 94066.]
[ 94118. 94116.]
[ 94109. 94102.]]
请帮助,提前谢谢!
答案 0 :(得分:1)
一个可能的原因是您要发送到Google API的请求数量。 你可以每天只拨打2500次电话给谷歌api。
进一步详细阅读: https://developers.google.com/maps/documentation/geocoding/usage-limits