ENH: add timedelta as valid type for interpolate with method='time'
State: closed

 - [x] closes #6424 
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master | flake8 --diff``
 - [ ] whatsnew entry



Labels:
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Timedelta
description: Timedelta data type

Comments:
this PR is currently a WIP, tests have not been added yet. This iteration is for initial reviews
@TomAugspurger the change that is currently in this PR will support timedelta as part of the index and the case presented in the issue

pd.DataFrame({'v':[1,np.nan,5]},index=pd.to_timedelta([1,2,3], unit="d")).interpolate(method="time")

will work

>>> pd.DataFrame({'v':[1,np.nan,5]},index=pd.to_timedelta([1,2,3], unit="d")).interpolate(method="time")
          v
1 days  1.0
2 days  3.0
3 days  5.0

Though i think what we expect here is that interpolate should work if the passed data is of type datetime or timedelta, something like this (below) should work (like how cut was enhanced). Is this the expectation?

>>> pd.DataFrame({'v':[np.datetime64('2012-01-01'),np.nan,np.datetime64('2012-01-03')]},index=[1,2,3]).interpolate()
           v
1 2012-01-01
2        NaT
3 2012-01-03


@jreback @jorisvandenbossche @TomAugspurger need pointers about expected functionality. I have added support for time delta as index when interpolating. Should we also be able to interpolate between input time data?
@aileronajay IIRC the original issue https://github.com/pandas-dev/pandas/issues/6424 was about interpolating when the index was timedeltas. We can support interpolating time delta data like in your second example as well. That's fine either in this PR or a separate one.
@TomAugspurger i will then add support for timedelta as index in this PR and create a separate PR for interpolating time data
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14799?src=pr) is 85.26% (diff: 100%)
> Merging [#14799](https://codecov.io/gh/pandas-dev/pandas/pull/14799?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will not change coverage

```diff
@@             master     #14799   diff @@
==========================================
  Files           144        144          
  Lines         50979      50979          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43469      43469          
  Misses         7510       7510          
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [36bb8af...fff59f5](https://codecov.io/gh/pandas-dev/pandas/compare/36bb8afb6f98dc19558c5ea32362dd033384ff25...fff59f5589b0ca47a755ab071120288819b4e167?src=pr)
are there other changes required in this PR? (like more tests?) @sinhrks @jreback @TomAugspurger @jorisvandenbossche 
@jreback i have made the change requested in the review, are there other changes that need to be taken care of?
@jreback I have made the suggested changes
minor doc change. ping on green.
@jreback there was a clean run in travis, appveyor failed after running for an hour, there appears to be a problem with appveyor
@aileronajay Thanks!