Fix index return type of exact match and add isnan
This commit is contained in:
parent
cefd7a2edd
commit
686ef6ce28
1 changed files with 7 additions and 2 deletions
|
|
@ -174,7 +174,7 @@ def find_neighbours(value, df, colname, start=0, end=-1):
|
||||||
|
|
||||||
exactmatch = df[df[colname] == value]
|
exactmatch = df[df[colname] == value]
|
||||||
if not exactmatch.empty:
|
if not exactmatch.empty:
|
||||||
return exactmatch.index
|
return exactmatch.index.values[0]
|
||||||
else:
|
else:
|
||||||
lower_df = df[df[colname] < value][colname]
|
lower_df = df[df[colname] < value][colname]
|
||||||
upper_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:
|
else:
|
||||||
upperneighbour_ind = np.nan
|
upperneighbour_ind = np.nan
|
||||||
|
|
||||||
return [lowerneighbour_ind, upperneighbour_ind]
|
return [lowerneighbour_ind, upperneighbour_ind]
|
||||||
|
|
||||||
|
|
||||||
|
def isnan(value):
|
||||||
|
|
||||||
|
return value!=value
|
||||||
Loading…
Add table
Add a link
Reference in a new issue