2

I am trying the new version of folium so I am using map.save instead of map.create_map. It was working with the older version but when I am using the new code, I am getting an error again and again saying SyntaxError: Invalid syntax. But I think I ma using the right code:

I am running this script:

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")

and I am getting this error:

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

Am I doing something wrong?

4

0 回答 0