diff --git a/rframe/indexes/interpolating_index.py b/rframe/indexes/interpolating_index.py index bfa5a87..f449dd6 100644 --- a/rframe/indexes/interpolating_index.py +++ b/rframe/indexes/interpolating_index.py @@ -23,6 +23,9 @@ def interpolater(x, xs, ys, kind="linear"): @interpolater.register(int) def interpolate_number(x, xs, ys, kind="linear"): if isinstance(ys[0], (float, int)): + sort = np.argsort(xs) + xs = np.array(xs)[sort] + ys = np.array(ys)[sort] return np.interp(x, xs, ys) return nn_interpolate(x, xs, ys)