geopandas.GeoSeries.notna

GeoSeries.notna()

Detect non-missing values.

Historically, NA values in a GeoSeries could be represented by empty geometric objects, in addition to standard representations such as None and np.nan. This behaviour is changed in version 0.6.0, and now only actual missing values return False. To detect empty geometries, use ~GeoSeries.is_empty instead.

Returns
A boolean pandas Series of the same size as the GeoSeries,
False where a value is NA.

See also

GeoSeries.isna

inverse of notna

GeoSeries.is_empty

detect empty geometries

Examples

>>> from shapely.geometry import Polygon
>>> s = geopandas.GeoSeries(
...     [Polygon([(0, 0), (1, 1), (0, 1)]), None, Polygon([])]
... )
>>> s
0    POLYGON ((0.00000 0.00000, 1.00000 1.00000, 0....
1                                                 None
2                             GEOMETRYCOLLECTION EMPTY
dtype: geometry
>>> s.notna()
0     True
1    False
2     True
dtype: bool