type cast error between geopandas and pandas

  geopandas, pandas, python

in the below code i want to find the distance between t1 and t2. the error message i am getting is as follows:

raise TypeError(type(this), type(other))
TypeError: (<class 'geopandas.geoseries.GeoSeries'>, <class 'pandas.core.series.Series'>)

to solve this issue, i manipulated the position of the square brackets but did not solve it.

please let me know how to fix it

code:

t1 = gpd.GeoSeries(Point([4.382617,50.811948]))
t2 = gpd.GeoSeries(Polygon([(4.338074,50.848677), (4.344961,50.833264), (4.366227,50.840809), (4.367945,50.852455), (4.346693,50.858306)]))
t1.crs = 4326
t2.crs = 4326
t = t1.distance(t2)

Source: Python Questions

LEAVE A COMMENT