我已经将一些数据提取到python中,我想在谷歌强度地图中将其可视化。这是我的python代码 - (相关部分)
query = "SELECT USState, NOFU2008 FROM " + TABLE_ID
data2008 = service.query().sql(sql=query).execute()
print data2008['columns']
query = "SELECT USState, NOFU2009 FROM " + TABLE_ID
data2009 = service.query().sql(sql=query).execute()
# print data2009
query = "SELECT USState, NOFU2010 FROM " + TABLE_ID
data2010 = service.query().sql(sql=query).execute()
variables = {"data2008": data2008}
self.render_response('index.html', json.encode(variables))
我想在浏览器上显示一个地图,其中包含三个按钮2008,2009和2010,根据点击的按钮,地图上的强度会发生变化。上面的代码给出了以下错误 -
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\Yash\New folder\data\Assignments\jmankoff-byte3\main.py", line 67, in get
self.render_response('index.html', json.encode(variables))
File "C:\Users\Yash\New folder\data\Assignments\jmankoff-byte3\main.py", line 33, in render_response
values.update(context)
ValueError: dictionary update sequence element #0 has length 1; 2 is required
INFO 2014-03-03 00:15:23,483 module.py:612] default: "GET / HTTP/1.1" 500 1858
注意 - 在上面的代码中我只传递了data2008。我还想要data2009和data2010。