[英]using google maps api with python
I'm following this guide in starting with gmaps api and python;我正在按照本指南从 gmaps api 和 python 开始;
import gmaps
import gmaps.datasets
import pandas as pd
def func():
# Use google maps api
gmaps.configure(api_key='MY_API_KEY') # Fill in with your API key
# Get the dataset
earthquake_df = gmaps.datasets.load_dataset_as_df('earthquakes')
# Get the locations from the data set
locations = earthquake_df[['latitude', 'longitude']]
# Get the magnitude from the data
weights = earthquake_df['magnitude']
# Set up your map
fig = gmaps.figure()
fig.add_layer(gmaps.heatmap_layer(locations, weights=weights))
return fig
func()
been using this code from the guide (both on pychram and jupyter notebooks) but when i run the code (pychram/jupyter/terminal) I don't get the output map like in the guide.一直在使用指南中的这段代码(在 pychram 和 jupyter 笔记本上),但是当我运行代码(pychram/jupyter/terminal)时,我没有像指南中那样得到输出映射。 just a nice old-fashion
只是一个不错的老式
Process finished with exit code 0
Check if it is enabled for jupyter first by running jupyter nbextension list
.首先通过运行
jupyter nbextension list
检查它是否为 jupyter 启用。 If you do not see jupyter-gmaps/extension enabled
then you need to run this line in terminal jupyter nbextension enable --py gmaps
and then run a new jupyter notebook.如果您没有看到
jupyter-gmaps/extension enabled
,那么您需要在终端jupyter nbextension enable --py gmaps
中运行此行,然后运行一个新的 jupyter notebook。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.