find closest date returns nan for min/max failure as well
This commit is contained in:
parent
18b60bd608
commit
7b65f6ff3f
@ -188,8 +188,14 @@ def _find_closest_date(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if delta.days < 0 and date < min(data.data):
|
if delta.days < 0 and date < min(data.data):
|
||||||
|
if if_not_found == "nan":
|
||||||
|
return float("NaN"), float("NaN")
|
||||||
|
else:
|
||||||
raise DateOutOfRangeError(date, "min")
|
raise DateOutOfRangeError(date, "min")
|
||||||
if delta.days > 0 and date > max(data.data):
|
if delta.days > 0 and date > max(data.data):
|
||||||
|
if if_not_found == "nan":
|
||||||
|
return float("NaN"), float("NaN")
|
||||||
|
else:
|
||||||
raise DateOutOfRangeError(date, "max")
|
raise DateOutOfRangeError(date, "max")
|
||||||
|
|
||||||
row: tuple = data.get(date, None)
|
row: tuple = data.get(date, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user