airbornegeo.interpolate_missing_pointwise

airbornegeo.interpolate_missing_pointwise#

interpolate_missing_pointwise(data, *, to_interp, interp_on, method='cubic', extrapolate=False, fill_value=None, groupby_column=None, progressbar=True)[source]#

Interpolate NaN’s in the “to_interp” column, based on values from “interp_on”. If groupby_column is provided, the dataframe will first be grouped by this so only data from the group containing the NaN is used to interpolate.

To interpolate multiple columns, call this function once per column.

Falls back through the hierarchy method -> ‘linear’ -> ‘nearest’ per-NaN if the requested method can’t be fit (insufficient points, or an actual fit failure). See _interpolate_missing_pointwise for details.

Parameters:
  • data (DataFrame) – Dataframe containing the data to interpolate

  • to_interp (str) – Column to interpolate

  • interp_on (str) – Column to interpolate on

  • method (str) – Interpolation method to use, by default “cubic”

  • extrapolate (bool) – Whether to extrapolate beyond the data range, by default False

  • fill_value (tuple[float, float] | str | None) – Value to use for filling gaps, by default None

  • groupby_column (str | None) – Column name to group by before interpolating, by default None

  • progressbar (bool) – Show progress bar for each group, by default True

Returns:

Dataframe with interpolated column

Return type:

DataFrame