착한가격업소를 찾아 지도에 매핑하는 코드를 짜보았다.
import folium
...
map = folium.Map(location=[target_table['위도'][0],target_table['경도'][0]],
zoom_start=13)
for i in target_table.index :
name = target_table['업소명'][i]
star = target_table['별점'][i]
menu = target_table['메뉴'][i]
price = target_table['가격'][i]
iframe = "이름 : " + name+ "<br> 별점 : "+ star + "<br> 대표메뉴 :" + menu + " [" + price + "]"
popup = folium.Popup(iframe, min_width=150, max_width=200)
folium.Marker([target_table['위도'][i],target_table['경도'][i]],
popup=popup, tooltip=name,
icon=folium.Icon(color='green')).add_to(map)
return map
iframe에 원하는 글자를 적고
popup에 iframe과 크기설정을 저장한 후
maker에 popup=popup을 해주면 커스텀할 수 있다!
tooltip은 마우스를 가져다댔을때 나오는 text이고
popup은 클릭하면 나오는 text이다.
참고자료 :
728x90
'프로그래밍 > Python' 카테고리의 다른 글
[Python] 날짜 형식 다루기 (datetime,timedelta) (0) | 2022.10.04 |
---|---|
[Python] 'ResultSet' object is not callable 에러 해결 (0) | 2022.08.23 |
[Pandas] 데이터프레임 인덱스 새로 설정하기(내포for문) (0) | 2022.08.20 |
[Pandas] 데이터프레임 정렬하기 (0) | 2022.08.20 |
[Python] 정규표현식 문법 (0) | 2022.08.20 |