python - 在 GeoPandas 中创建数据框会给出“TypeError super(type, obj): obj must be an instance or subtype of type”
问题描述
TypeError: super(type, obj): obj must be an instance or subtype of type
为 2 列 lat 和 long 的点创建 1 列时
你能帮我解决这个问题吗?
我有一个数据集 customer_lat, customer_lng 我想从 lat long 创建 1 列作为一个点
from shapely.geometry import Polygon
from shapely.geometry import Point
import pandas as pd
import geopandas as gpd
df=pd.read_csv("C:\\Users\\n.nguyen.2\\Documents\\order from May 1.csv")
geometry=[Point(xy) for xy in zip(df['customer_lat'],df['customer_lng'])]
crs={'init':'epsg:4326'}
gdf=gpd.GeoDataFrame(df,crs=crs,geometry=geometry)
gdf.head()
Traceback (most recent call last):
File "<ipython-input-82-1f38d31ae996>", line 9, in <module>
gdf=gpd.GeoDataFrame(df,crs=crs,geometry=geometry)
File "C:\Users\n.nguyen.2\AppData\Local\Continuum\anaconda3\lib\site-packages\geopandas\geodataframe.py", line 47, in __init__
super(GeoDataFrame, self).__init__(*args, **kwargs)
TypeError: super(type, obj): obj must be an instance or subtype of type
解决方案
推荐阅读
- android - 无法打印整个字符串值
- google-chrome - 在 Google Chrome 中测量数据传输?
- pip - Pip.conf 文件使用环境变量
- vba - 有没有办法将工作表中的变量用作 Powershell 的 VBA 命令 Shell() 中的参数?
- python - Kivy Plyer 通知
- php - 我如何使用配对的父子与 php 来订购此列表?
- python-3.x - 如何禁用 Airflow 登录以进行身份验证和授权?
- c# - C# - 使用 Dapper 构建分层数据结构
- bash - Sun Grid Engine 集群(starcluser)中的 GNU 并行?
- regex - 如何用单个斜杠替换多个正斜杠