FIX: fix interpolate with kwarg limit area and limit direction using pad or bfill
State: closed

- [x] closes #26796
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

This separates a large part of the code changes from #25141 to keep things comprehendible.


Labels:
name: Bug
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode

Comments:
Hello @cchwala! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:









There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2020-09-15 15:40:12 UTC
@cchwala so IIUC you are doing a precursor to solve the issue with pad and `limit_area` and then planning to add `max_gap` after that gets merged in the original PR right?
@WillAyd Yes. That is my plan. 

I am reusing the code from the PR with `max_gap` that actually solves #26796. The `max_gap` PR will be a lot smaller when the changes from this PR are merge. 
Should be ready now. I am offline for some hours of sleep, though.
@WillAyd Any further requests for changes?
@cchwala can you address comments?
@WillAyd Sorry for the delay. 

I adjusted the code according to most comments. I am now looking into the last two open comments and will respond/commit when I have an answer.
@WillAyd @jreback Can you comment on the changes. I would potentially have time to further work on this and the related https://github.com/pandas-dev/pandas/pull/25141, which has to wait till this is merged.
@WillAyd I resolved the conflicts with upstream/master so that this PR can potentially be merged.
@WillAyd Sorry for missing the details of the required changes. These are solved now.
@cchwala can you merge master.
@cchwala can you merge master
@simonjayhawkins I think this is worth merge *after* your set cleaning in interpolate.
> @simonjayhawkins I think this is worth merge _after_ your set cleaning in interpolate.

i've done this locally but get
```
$ git push
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push upstream HEAD:refs/pull/31048/head

To push to the branch of the same name on the remote, use

    git push upstream fix_interpolate_limit_area_and_limit_direction_with_pad

To choose either option permanently, see push.default in 'git help config'.
```

am using hub.

BUT tests are failing. I think related to changes in #33959. not looked yet.
> BUT tests are failing. I think related to changes in #33959. not looked yet.

will need to make some changes to the implementation of #33959, will raise a PR shortly based on changes in #34749
@simonjayhawkins Sorry for not responding. I was, and still am, very busy with other things. I am available to help with this PR from July on.
Hi @cchwala - is this still active?
> not really sure of the status here and @simonjayhawkins had some cleanups as well, can we clarify.

I did break some bits off this PR. so does need a merge of master to see what's left (I did try this https://github.com/pandas-dev/pandas/pull/31048#issuecomment-643394779)
Okay. I will do the merge with master today to see what is left. I guess, at least the tests will still be of value.
I am now looking into [the suggestion](https://github.com/pandas-dev/pandas/pull/31048/files/e259549e2f369bd07a731681d1278e1e5d605007#r439754395) from @simonjayhawkins to use `interpolate_2d` instead of introducing `interpolate_1d_fill` to add less clutter to the already cluttered code.
@jreback can you please have another look? As expected there is not much left from this PR because parts of it have already been merged elsewhere. Most of your code review comments do not apply anymore, only [this one](https://github.com/pandas-dev/pandas/pull/31048/files/e259549e2f369bd07a731681d1278e1e5d605007#r477598954).
@jreback Sorry to ping you again, but it would be great if I could finish this PR with (hopefully) final adjustments tomorrow (Friday). Otherwise things would have to wait again another two weeks because I will be offline.
will have to wait as i am away
Okay. No problem.
@cchwala can you resolve merge conflicts and can take another look
moving off 1.2 need merge master and update to comments.
Closing in favor of #38106