Geodataframe.explore() 오류: __init__() 누락된 1개의 필수 위치 인수: '위치' (Geodataframe.explore() error: __init__() missing 1 required positional argument: 'location')


문제 설명

Geodataframe.explore() 오류: init() 누락된 1개의 필수 위치 인수: '위치' (Geodataframe.explore() error: init() missing 1 required positional argument: 'location')

Colab에서 Geopandas와 그 explore() 메서드를 사용하여 대화형 지도를 구성하려고 합니다.

하지만 다음을 작성할 때:

my_geodataframe.explore()

다음 오류가 발생합니다.

TypeError                                 Traceback (most recent call last)
<ipython‑input‑11‑e71fb33b059f> in <module>()
‑‑‑‑> 1 mapa_interactivo = mapa1.explore()

1 frames
/usr/local/lib/python3.7/dist‑packages/geopandas/explore.py in _explore(df, column, cmap, color, m, tiles, attr, tooltip, popup, highlight, categorical, legend, scheme, k, vmin, vmax, width, height, categories, classification_kwds, control_scale, marker_type, marker_kwds, style_kwds, highlight_kwds, missing_kwds, tooltip_kwds, popup_kwds, legend_kwds, **kwargs)
    511             marker_kwds["radius"] = marker_kwds.get("radius", 2)
    512             marker_kwds["fill"] = marker_kwds.get("fill", True)
‑‑> 513             marker = folium.CircleMarker(**marker_kwds)
    514         else:
    515             raise ValueError(

TypeError: __init__() missing 1 required positional argument: 'location'

위치를 명시적으로 작성합니다.

my_geodataframe.explore(location=[40.463667, ‑3.74922])

하지만 오류는 여전히 남아 있습니다.

스페인의 주별 실업률을 보여주는 지도를 만들고 있습니다. 지리 데이터는 다음 소스에서 다운로드할 수 있습니다.

http://centrodedescargas.cnig.es/CentroDescargas/buscar.do?filtro.codFamilia=LILIM&filtro.codCA=11#


참조 솔루션

방법 1:

The first positional argument to geopandas.GeoDataFrame.explore is column:

column: str, np.array, pd.Series (default None)
The name of the dataframe column, numpy.array, or pandas.Series to be plotted. If numpy.array or pandas.Series are used then it must have same length as dataframe.

If you're plotting a dataframe with more than one column, be sure to provide the name of the column you would like to explore, as in:

my_geodataframe.explore('Tasa_Paro')

방법 2:

The code above is correct. The issue is that you are using the old, unsupported version of folium. GeoPandas explore has been designed to work with folium 0.12 and newer, you need to update.

(by AlejandroDGRMichael Delgadomartinfleis)

참조 문서

  1. Geodataframe.explore() error: init() missing 1 required positional argument: 'location' (CC BY‑SA 2.5/3.0/4.0)

#geopandas #Python #Dictionary






관련 질문

{'northeast': {'lat':}, 'southwest': {'lat': }}(Google 지도) Python에서 다각형을 만드는 방법 (How to create Polygon out of {'northeast': {'lat':}, 'southwest': {'lat': }} (google maps) Python)

모양이 교차하는 다각형의 수를 어떻게 계산합니까? (How can I count the number of polygons a shape intersects?)

GeoPandas를 사용하여 Python에서 GRASS 벡터 데이터 소스 읽기 (Read GRASS vector datasources in Python using GeoPandas)

어떤 점에 포함된 영역을 찾는 Geopandas (Geopandas to locate which area does a point contains)

Geopandas Dataframe이 인덱스 오류를 반환하는 이유 (Why is the Geopandas Dataframe returning an Index Error)

여러 선스트링으로 구성된 shapefile을 분할하는 방법 (How to split a shapefile compose of multiple linestrings)

LineString 유형의 개체는 JSON 직렬화가 불가능합니다. (Object of type LineString is not JSON serializable)

큰 geotif 파일 열기 (Open large geotif file)

점이 있는 geopandas 데이터 프레임에서 다각형 만들기 (Creating a polygon from a geopandas dataframe with points)

여러 소스 및 대상 노드에 대한 Networkx 최단 경로 분석 (Networkx Shortest Path Analysis on multiple source and target nodes)

위도/경도 포인트가 다각형 내에 있는지 어떻게 확인합니까? (How do I determine if a lat/long point is within a polygon?)

Geodataframe.explore() 오류: __init__() 누락된 1개의 필수 위치 인수: '위치' (Geodataframe.explore() error: __init__() missing 1 required positional argument: 'location')







코멘트