airbornegeo.interpolate_missing

airbornegeo.interpolate_missing#

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

Interpolate NaN’s in a dataframe’s “to_interp” column, based on values from the “interp_on” column. Falls back through method -> ‘linear’ -> ‘nearest’ if the requested method can’t be fit (insufficient points, or an actual fit failure), trying each in turn rather than deciding once from point count alone.

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

method:

‘linear’, ‘nearest’, ‘nearest-up’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’

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