前提・実現したいこと
pandasのdataframeからGeoSeriesを作成する際にShapelyDeprecationWarningとワーニングが出るのだけど対処がわからない。
発生している問題・エラーメッセージ
C:\Program Files\Python310\lib\site-packages\pandas\core\dtypes\cast.py:118: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
該当のソースコード
python
1import pandas as pd 2from shapely.geometry import Point 3dfb = pd.DataFrame( 4 [ 5 [35.6585840, 139.7454316], 6 [35.7100069, 139.8108103], 7 [35.6842961, 139.8647716], 8 ], columns = ['緯度', '経度'] 9) 10series_geom_b=dfb.apply(lambda x:Point(x['経度'],x['緯度']), axis=1)
もしかして。
以下であればワーニングは出ないですが、これでGeoDataFrame作成しろということでしょうか。
python
1list_geom=[] 2for index, row in dfb.iterrows(): 3 list_geom.append(Point(row['経度'],row['緯度']))
補足情報(FW/ツールのバージョンなど)
Shapely 1.8.0
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。