Я получаю ошибки, пытаясь выполнить базовое c преобразование 2 координатных столбцов в объект Point для создания кадра данных Geo Pandas.
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
x = np.random.normal(size=10).tolist()
y = np.random.normal(size=10).tolist()
dict0 = {
'x':x,
'y':y
}
df = pd.DataFrame(dict0)
# the geopandas.points_from_xy doesnt seem to exist anymore
gpd.GeoDataFrame(df,gpd.points_from_xy(df.x,df.y))
#this raises the error of cannot convert to class
gpd.GeoDataFrame(df,geometry=Point(df.x,df.y))
Таким образом, путь geo pandas вызывает ошибку: AttributeError: module 'geopandas' has no attribute 'points_from_xy'
Возможно, она больше не существует? В любом случае, альтернативой является использование Point from Shapely.
При правильном способе возникает следующая ошибка:
raise TypeError("cannot convert the series to " "{0}".format(str(converter)))
TypeError: cannot convert the series to <class 'float'>
Данные x и y явно являются данными с плавающей точкой. Есть идеи, как превзойти эту ошибку и получить балл?