Repository: scipy/scipy

Issue:
Interpolating categorical data (interp1d)
I'm trying to interpolate non-numerical data, and tried using the [interp1d](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html). 

```python
from scipy.interpolate import interp1d
x = [1.4, 2.8, 3.1, 4.4, 5.2]
y = ['A', 'B', 'A', 'A', 'B']
f = interp1d(x, y, kind='nearest', fill_value=None)
x_new = [1, 2, 3, 4, 5]
y_new = f(x_new)
```
However, it throws a `ValueError`: 

```python
ValueError                                Traceback (most recent call last)
<ipython-input-50-d6a055a2aef9> in <module>
----> 1 f = interp1d(x, y, kind='nearest', fill_value=None)

c:\python38\lib\site-packages\scipy\interpolate\interpolate.py in __init__(self, x, y, kind, axis, copy, bounds_error, fill_value, assume_sorted)
    459         # Force-cast y to a floating-point type, if it's not yet one
    460         if not issubclass(y.dtype.type, np.inexact):
--> 461             y = y.astype(np.float_)
    462
    463         # Backward compatibility

ValueError: could not convert string to float: 'A'
```

**Example output**

The example output would look, with `kind='nearest'` and `kind='previous'`:
```python
# with kind= 'nearest'
x_new = [1, 2, 3, 4, 5]
y_new = ['A', 'A', 'A', 'A', 'B']

# with kind= 'previous', fill_value = None
x_new = [1, 2, 3, 4, 5]
y_new = [None, 'A', 'B', 'A', 'A']
```

**Describe alternatives you've considered**
I asked a question about this on [stackoverflow](https://stackoverflow.com/questions/62015823/interpolating-categorical-data-in-python-nearest-previous-value/62016097#62016097) and one suggestion was to do the interpolation on the indexes, instead.  However, of course it would be more handy, if the `interp1d` could do this out of the box.



Discussion:
TBH I'd think the workaround given on SO is as good as it gets. Scipy.interpolate functions receive and return floating-point values ; pre- and post-processing is best done on a user side

Resolving patch:
diff --git a/scipy/interpolate/interpolate.py b/scipy/interpolate/interpolate.py
--- a/scipy/interpolate/interpolate.py
+++ b/scipy/interpolate/interpolate.py
@@ -334,9 +334,6 @@ class interp1d(_Interpolator1D):
     ``y = f(x)``. This class returns a function whose call method uses
     interpolation to find the value of new points.
 
-    Note that calling `interp1d` with NaNs present in input values results in
-    undefined behaviour.
-
     Parameters
     ----------
     x : (N,) array_like
@@ -400,6 +397,15 @@ class interp1d(_Interpolator1D):
     UnivariateSpline : An object-oriented wrapper of the FITPACK routines.
     interp2d : 2-D interpolation
 
+    Notes
+    -----
+    Calling `interp1d` with NaNs present in input values results in
+    undefined behaviour.
+
+    Input values `x` and `y` must be convertible to `float` values like 
+    `int` or `float`.
+
+
     Examples
     --------
     >>> import matplotlib.pyplot as plt
diff --git a/scipy/interpolate/polyint.py b/scipy/interpolate/polyint.py
--- a/scipy/interpolate/polyint.py
+++ b/scipy/interpolate/polyint.py
@@ -69,6 +69,11 @@ def __call__(self, x):
             Interpolated values. Shape is determined by replacing
             the interpolation axis in the original array with the shape of x.
 
+        Notes
+        -----
+        Input values `x` must be convertible to `float` values like `int` 
+        or `float`.
+
         """
         x, x_shape = self._prepare_x(x)
         y = self._evaluate(x)


Test patch: