geopandas.GeoSeries.is_valid¶
- property GeoSeries.is_valid¶
Returns a
Series
ofdtype('bool')
with valueTrue
for geometries that are valid.Examples
An example with one invalid polygon (a bowtie geometry crossing itself) and one missing geometry:
>>> from shapely.geometry import Polygon >>> s = geopandas.GeoSeries( ... [ ... Polygon([(0, 0), (1, 1), (0, 1)]), ... Polygon([(0,0), (1, 1), (1, 0), (0, 1)]), # bowtie geometry ... Polygon([(0, 0), (2, 2), (2, 0)]), ... None ... ] ... ) >>> s 0 POLYGON ((0.00000 0.00000, 1.00000 1.00000, 0.... 1 POLYGON ((0.00000 0.00000, 1.00000 1.00000, 1.... 2 POLYGON ((0.00000 0.00000, 2.00000 2.00000, 2.... 3 None dtype: geometry
>>> s.is_valid 0 True 1 False 2 True 3 False dtype: bool