【发布时间】:2020-04-12 20:21:48
【问题描述】:
我正在尝试对整个列执行操作,但出现类型错误,我想创建一个包含 Shapely Point 的列:
crime_df = crime_df[crime_df['Latitude'].notna()]
crime_df = crime_df[crime_df['Longitude'].notna()]
crime_df['Longitude'] = crime_df['Longitude'].astype(float)
crime_df['Latitude'] = crime_df['Latitude'].astype(float)
print (crime_df['Longitude'])
print (crime_df['Latitude'])
crime_df['point'] = Point(crime_df['Longitude'], crime_df['Latitude'])
输出:
18626 -87.647379
Name: Longitude, Length: 222, dtype: float64
18626 41.781100
Name: Latitude, Length: 222, dtype: float64
TypeError: cannot convert the series to <class 'float'>
【问题讨论】:
标签: python pandas point shapely