geopandas.GeoSeries.notna#
- GeoSeries.notna()[来源]#
检测非缺失值。
历史上,GeoSeries中的NA值可以通过空几何对象表示,除了像None和np.nan这样的标准表示。这个行为在0.6.0版本中发生了变化,现在只有实际缺失值才会返回False。要检测空几何体,请使用
~GeoSeries.is_empty。- Returns:
- A boolean pandas Series of the same size as the GeoSeries,
- False where a value is NA.
另请参阅
GeoSeries.isnanotna的逆
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.notna() 0 True 1 False 2 True dtype: bool