【Python地图可视化】Folium展示悉尼Airbnb房价

根据价格进行分类,为不同价格打上价格标签标签

#对价格进行分类

price_tag = []
for i in range(len(train)):
  if train.loc[i+2000,'price'] <= 100:
    price_tag.append('0-100')
  elif train.loc[i+2000,'price']<=200:
    price_tag.append("100-200")
  elif train.loc[i+2000,'price']<=300:
    price_tag.append('200-300')
  elif train.loc[i+2000,'price']<=400:
    price_tag.append('300-400')
  else:
    price_tag.append('>400')

train['Price_tag'] = price_tag
import folium
# define the sydney map
sydney_map = folium.Map(location=[-33.8688, 151.2093], zoom_start=12,tiles='Stamen Toner')

#针对不同价格,用不同颜色表示
for i in range(len(train)):
  if train.loc[i+2000,'Price_tag'] == '0-100':
    folium.Marker(
        location=[train.loc[i

猜你喜欢

转载自blog.csdn.net/weixin_52589734/article/details/119107977