geopandas point in polygon
Not really clear what kind of data structures you actually have. Also, all your expected results are False, so that's kind of hard to check. Assuming GeoSeries and GeoDataFrames, I would do this:
from shapely.geometry import Point, Polygonimport geopandaspolys = geopandas.GeoSeries({ 'foo': Polygon([(5, 5), (5, 13), (13, 13), (13, 5)]), 'bar': Polygon([(10, 10), (10, 15), (15, 15), (15, 10)]),})_pnts = [Point(3, 3), Point(8, 8), Point(11, 11)]pnts = geopandas.GeoDataFrame(geometry=_pnts, index=['A', 'B', 'C'])pnts = pnts.assign(**{key: pnts.within(geom) for key, geom in polys.items()})print(pnts)
And that gives me:
geometry bar fooA POINT (3 3) False FalseB POINT (8 8) False TrueC POINT (11 11) True True