DOC: fix docstring for DataFrame.interpolate
State: closed

In the old docstring, `'index'` is listed as a valid value for the `method` kwarg for `DataFrame.interpolate`. It looks like a typo, because there was no comma after `'index'`, and the explanation for `'index'` corresponded to `'values'`. Furthermore, it appears `'index'` is not a valid value for `method`:

``` python
In [67]: df = pd.DataFrame([[1], [2], [np.nan], [3]], index=[0, 0.7, 1.1, 4])

In [68]: df
Out[68]: 
      0
0.0   1
0.7   2
1.1 NaN
4.0   3

In [69]: df.interpolate(method="index")
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-69-4cef75cee92e> in <module>()
----> 1 df.interpolate(method="index")

/home/david/miniconda3/envs/frackoptima/lib/python3.4/site-packages/pandas/core/generic.py in interp
olate(self, method, axis, limit, inplace, downcast, **kwargs)                                      
   2580                                           inplace=inplace,
   2581                                           downcast=downcast,
-> 2582                                           **kwargs)
   2583         if inplace:
   2584             if axis == 1:

/home/david/miniconda3/envs/frackoptima/lib/python3.4/site-packages/pandas/core/internals.py in inte
rpolate(self, **kwargs)                                                                            
   2195 
   2196     def interpolate(self, **kwargs):
-> 2197         return self.apply('interpolate', **kwargs)
   2198 
   2199     def shift(self, **kwargs):

/home/david/miniconda3/envs/frackoptima/lib/python3.4/site-packages/pandas/core/internals.py in appl
y(self, f, axes, filter, do_integrity_check, **kwargs)                                             
   2162                                                  copy=align_copy)
   2163 
-> 2164             applied = getattr(b, f)(**kwargs)
   2165 
   2166             if isinstance(applied, list):

/home/david/miniconda3/envs/frackoptima/lib/python3.4/site-packages/pandas/core/internals.py in inte
rpolate(self, method, axis, index, values, inplace, limit, fill_value, coerce, downcast, **kwargs) 
    667                                      **kwargs)
    668 
--> 669         raise ValueError("invalid method '{0}' to interpolate.".format(method))
    670 
    671     def _interpolate_with_fill(self, method='pad', axis=0, inplace=False,

ValueError: invalid method 'index' to interpolate.

In [70]: df.interpolate(method="values")
Out[70]: 
            0
0.0  1.000000
0.7  2.000000
1.1  2.121212
4.0  3.000000
```


Labels:
name: Docs
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: API Design

Comments:
hmm.... @TomAugspurger ?

I think 'index' and 'values' are supposed to be synonyms: https://github.com/pydata/pandas/pull/4915#issuecomment-24868810

values was the old one, but 'index' makes more sense after that PR.

@jdreaver want to adjust your PR to do this? Just need to add 'index' to `_clean_interp_method`  and change to `if method in ['linear', 'time', 'values', 'index']:` in `interpolate_1d` in core/common.py.

I can do a PR if need be, but my wi-fi has been spotty :(

That makes sense. Should I remove `'values'` from the docstring for `DataFrame.interpolate()` entirely, replacing it with `'index'`? Or should I add `'index'` as an argument to `method` and change the relevant docstring line to `'index', 'values': use the actual numerical values of the index`?

I went ahead and added `'index'` as a synonym. I can remove `'values'` from the docstring too if you want. Just tell me.

they index is their for compat as that was the old method iirc

@TomAugspurger what is `index` supposed to map to? any tests for this?

@jdreaver can you add some tests for this ? 

@jreback, I'll get around to it in the next couple days.

@TomAugspurger what's the status here?

I think just waiting on a test that @jdreaver's fix is correct. The code looks fine, but it'd be nice to have a test.

I guess I didn't get around to it... I'll do it today in the next few hours.

I found the test where `method='values'` was tested, and I added a few lines to check that the output of `'values'` and `'index'` is the same. If travis passes, I think the pull request is complete.

gr8 pls ping in green

@jdreaver thanks!

No problem! Sorry for forgetting about writing those tests!