我使用csv文件中的坐标在地图上绘图。但是在地图上只有一点。
from pyecharts import Geo
import pandas as pd
df=pd.read_csv(r"C:\157.csv")
df.head()
geo_cities_coords={i:[df.iloc[i]["Lon"],df.iloc[i]["Lat"]] for i in range(len(df))}
print(geo_cities_coords)
attr=list(df["City"])
value=list(df["Days"]/100000)
geo = Geo("Title", "subtitle", title_color="#fff", title_pos="center",width=1200, height=600, background_color='#404a59')
geo.add("",attr,value,visual_range=[0,100],symbol_size= 5,
visual_text_color= "#fff",is_piecewise = True,
is_visualmap= True,maptype = '北京', visual_split_number= 10,
geo_cities_coords=geo_cities_coords)
geo.render( 'test.html')
CSV文件格式:
City,Lat,Lon,Days
1,39.97556667,116.33035,39201.35731
2,39.97545,116.3302333,39201.35903
3,39.97383333,116.3329667,39201.52389