Skip to main content
Fill NA values with geometry (or geometries).

Signature

Parameters

shapely geometry or GeoSeries
default:"None"
If None is passed, NA values will be filled with GEOMETRYCOLLECTION EMPTY. If a shapely geometry object is passed, it will be used to fill all missing values. If a GeoSeries is passed, missing values will be filled based on the corresponding index locations. If pd.NA or np.nan are passed, values will be filled with None (not GEOMETRYCOLLECTION EMPTY).
bool
default:"False"
int
default:"None"
This is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None.

Returns

GeoSeries
Index alignment with another GeoSeries is lazy. Invalid duplicate replacement indexes raise a Spark error when the result is evaluated, rather than a Python ValueError when calling fillna. This also applies to inplace=True. A query that skips evaluating the result may skip this validation.On Spark 3.5.0—3.5.3, evaluating the same failed result again can hang with adaptive query execution enabled (SPARK-49979). This also affects failed inplace=True results. Use Spark 3.5.4 or newer to avoid this upstream issue.Sharing the alignment relies on spark.sql.exchange.reuse=true (the default). Disabling it can execute the alignment four times instead of once. Validation does not force a broadcast; normal Spark broadcast settings still apply to the separate label join.Using limit requires distributed global ordering and can be expensive for large GeoSeries.
See also
  • GeoSeries.isna: detect missing values

Examples

Filled with an empty polygon.
Filled with a specific polygon.
Filled with another GeoSeries.