geopandas.GeoSeries.isna#

GeoSeries.isna()[来源]#

检测缺失值。

历史上,GeoSeries中的NA值可以通过空几何对象表示,除了标准表示方法如None和np.nan。这个行为在0.6.0版本中进行了改变,现在只有实际缺失的值返回True。要检测空几何体,请使用 GeoSeries.is_empty

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

另请参阅

GeoSeries.notna

isna 的反函数

GeoSeries.is_empty

检测空几何

示例

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