def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None,<EOL>bounds_error=False, order=None, **kwargs):
try:<EOL><INDENT>from scipy import interpolate<EOL>from pandas import DatetimeIndex  <EOL><DEDENT>except ImportError:<EOL><INDENT>raise ImportError('<STR_LIT>'<EOL>.format(method=method))<EOL><DEDENT>new_x = np.asarray(new_x)<EOL>alt_methods = {<EOL>'<STR_LIT>': interpolate.barycentric_interpolate,<EOL>'<STR_LIT>': interpolate.krogh_interpolate,<EOL>'<STR_LIT>': _from_derivatives,<EOL>'<STR_LIT>': _from_derivatives,<EOL>}<EOL>if getattr(x, '<STR_LIT>', False):<EOL><INDENT>x, new_x = x._values.astype('<STR_LIT>'), new_x.astype('<STR_LIT>')<EOL><DEDENT>if method == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>alt_methods['<STR_LIT>'] = interpolate.pchip_interpolate<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise ImportError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>from scipy.interpolate import Akima1DInterpolator  <EOL>alt_methods['<STR_LIT>'] = _akima_interpolate<EOL><DEDENT>except ImportError:<EOL><INDENT>raise ImportError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>interp1d_methods = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>']<EOL>if method in interp1d_methods:<EOL><INDENT>if method == '<STR_LIT>':<EOL><INDENT>method = order<EOL><DEDENT>terp = interpolate.interp1d(x, y, kind=method, fill_value=fill_value,<EOL>bounds_error=bounds_error)<EOL>new_y = terp(new_x)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>if isna(order) or (order <= <NUM_LIT:0>):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(order))<EOL><DEDENT>terp = interpolate.UnivariateSpline(x, y, k=order, **kwargs)<EOL>new_y = terp(new_x)<EOL><DEDENT>else:<EOL><INDENT>if not x.flags.writeable:<EOL><INDENT>x = x.copy()<EOL><DEDENT>if not y.flags.writeable:<EOL><INDENT>y = y.copy()<EOL><DEDENT>if not new_x.flags.writeable:<EOL><INDENT>new_x = new_x.copy()<EOL><DEDENT>method = alt_methods[method]<EOL>new_y = method(x, y, new_x, **kwargs)<EOL><DEDENT>return new_y<EOL>
Passed off to scipy.interpolate.interp1d. method is scipy's kind.
Returns an array interpolated at new_x.  Add any new methods to
the list in _clean_interp_method.