使用folium新版本map.save并获取语法错误

时间:2017-01-24 11:32:14

标签: python-3.x pandas folium

我正在尝试新版本的folium,所以我使用map.save而不是map.create_map。它使用的是旧版本,但是当我使用新代码时,我又一次收到错误,并说SyntaxError:语法无效。但我想我可以使用正确的代码:

我正在运行此脚本:

import pandas, folium

df = pandas.read_csv(".....txt")

map = folium.Map(location= [df["LAT"].mean(), df["LON"].mean()], zoom_start = 6, tiles = "Stamen Terrain")

def color(elev):
    minimum= int(min(df["ELEV"]))
    step= int((max(df["ELEV"])-min(df["ELEV"]))/3 )
    if elev in range(minimum,minimum+step):
        col= "blue"
    elif elev in range(minimum+step,(minimum+step)*2):
        col= "orange"
    else:
        col = "red"
    return col


for lat,lon,name,elev in zip(df['LAT'], df['LON'], df['NAME'], df['ELEV']):
   map.add_child(folium.Marker(location=[lat, lon], popup = name, icon=   folium.Icon(color= color(elev)))       



map.save(outfile= "test.html")

我收到此错误:

   ...: 
   File "<ipython-input-2-02945dfe5a14>", line 27
     map.save(outfile= "test.html")
       ^
 SyntaxError: invalid syntax

我做错了吗?

0 个答案:

没有答案