API: validate limit_direction parameter of NDFrame.interpolate by simonjayhawkins · Pull Request #34746 · pandas-dev/pandas (original) (raw)

simonjayhawkins

@cchwala

This test currently only test limit_area.

For limit_direction the implementation should later raise an error, because pad and bfill both already define a direction. But let's now first do the implementation of the limit_area for pad and bfill.

@cchwala

Since methods pad and bfill in blocks.interpolate end up using missing.interpolate_2d which can not (easily) be extended to support limit_area, I introduce the new function missing.interpolate_1d_fill. It is a modified copy of interpolate_2d but only works for 1d data and uses newly introduced function _derive_indices_of_nans_to_preserve, which is now also used in missing.interpolate_1d. It works the same way as the 1D-interpolation functions which are based on scipy-interpolation which are applied via np.apply_along_axis.

@cchwala

@cchwala

@cchwala

…valuesalso was changed via appliyingfunc`

@cchwala

…e used

Test for all forbidden combos of pad and backfill is included

@cchwala

@cchwala

@cchwala

@cchwala

@cchwala

@cchwala

@cchwala

…ments

Test on my local machine are not affected by removing the unncessery arguments valid and invalid, which are now derived within the function.

@cchwala

@cchwala

@cchwala

@cchwala

-black formating -remove variables that are now obsolete

@cchwala

@cchwala

@cchwala

…imit_area_and_limit_direction_with_pad

Manually resolved conflicts:

@cchwala @WillAyd

Co-Authored-By: William Ayd william.ayd@icloud.com

@cchwala

@cchwala

@simonjayhawkins

…imit_area_and_limit_direction_with_pad

@simonjayhawkins

…imit_area_and_limit_direction_with_pad

@simonjayhawkins

WillAyd

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jreback

can you rebase, otherwise lgtm.

@simonjayhawkins

@simonjayhawkins

@jreback