folium으로 choropleth을 이용해 지도 시각화를 할 때,
ValueError: Cannot render objects with any missing geometries와 같은 오류가 발생했다.
이경우 데이터의 type을 확인해보자.
<class 'pandas.core.frame.DataFrame'>가 아닌 <class 'geopandas.geodataframe.GeoDataFrame'>으로 데이터를 넣어야 한다.
해결) geodataframe과 dataframe의 데이터를 merge할 때, geodataframe에 dataframe을 merge해야 한다.
pd.merge()로 merge할 경우 위 같은 에러발생
# 해결 예시
df #DataFrame
geodf #GeoDataFrame
# geodf로 merge해야함
geodf = geodf.merge(df, left_on="col_1", right_on="col_2", how="outer")
참고 사이트 :
ValueError: Cannot render objects with any missing geometries when using a geopandas dataframe
I am trying to add a choropleth layer on a folium map using a geopandas dataframe that I built by merging a shapefile containing all the regions in Brazil (named "map_1"), with a regular pandas dat...
stackoverflow.com
반응형
'Error note' 카테고리의 다른 글
[python] UserWarning: Glyph 52489 (\N{HANGUL SYLLABLE COG}) missing from current font. (0) | 2023.03.15 |
---|---|
[Jupyter] 500 : Internal Server Error (0) | 2022.12.30 |
[python] spacy : Can't find model 'en_core_web_sm' (0) | 2022.06.08 |
[Linux] centOS 리눅스 한글 입력방법, 한/영키 변환 (0) | 2022.03.15 |
[Linux] maria db, mysql에서 한글이 깨져서 나올 때 해결방법 (0) | 2022.03.15 |