From 686ef6ce2863ea455c599ee8484ebc822f0c2288 Mon Sep 17 00:00:00 2001 From: rasmusvt Date: Sun, 23 Oct 2022 20:24:31 +0200 Subject: [PATCH] Fix index return type of exact match and add isnan --- nafuma/auxillary.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nafuma/auxillary.py b/nafuma/auxillary.py index 1cc6f24..8e428b5 100644 --- a/nafuma/auxillary.py +++ b/nafuma/auxillary.py @@ -174,7 +174,7 @@ def find_neighbours(value, df, colname, start=0, end=-1): exactmatch = df[df[colname] == value] if not exactmatch.empty: - return exactmatch.index + return exactmatch.index.values[0] else: lower_df = df[df[colname] < value][colname] upper_df = df[df[colname] > value][colname] @@ -190,4 +190,9 @@ def find_neighbours(value, df, colname, start=0, end=-1): else: upperneighbour_ind = np.nan - return [lowerneighbour_ind, upperneighbour_ind] \ No newline at end of file + return [lowerneighbour_ind, upperneighbour_ind] + + +def isnan(value): + + return value!=value \ No newline at end of file