Skip to content

Commit

Permalink
sort before interpolate
Browse files Browse the repository at this point in the history
  • Loading branch information
zihaoxu98 committed Jun 19, 2024
1 parent 06af8ef commit f835443
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rframe/indexes/interpolating_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f835443

Please sign in to comment.